[R] how to predict dynamic model in R

Gabor Grothendieck ggrothendieck at gmail.com
Thu Jul 23 07:04:52 CEST 2009


Use dyn.predict like this:

> library(dyn)
> x <- y <- zoo(1:5)
> mod <- dyn$lm(y ~ lag(x, -1))
> predict(mod, list(x = zoo(6:10, 6:10)))
 7  8  9 10
 7  8  9 10


On Thu, Jul 23, 2009 at 12:54 AM, Hongwei Dong<pdxdong at gmail.com> wrote:
> I have a dynamic time series model like this:
> dyn$lm( y ~ lag(y,-1) + x + lag(x,-1)+lag(x,-2) )
>
> I need to do an out of sample forecast with this model. Is there any way I
> can do this with R?
> It would be greatly appreciated if some one can give me an example. Thanks.
>
>
> Harry
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>




More information about the R-help mailing list