Try this:

# test data
set.seed(1)
y <- ts(1:10 + rnorm(10, 0, 0.1))

# fit model
library(dyn)
y.lm <- dyn$lm(y ~ lag(y,-1))

# use predict
tail(predict(y.lm, list(y = y)), 1)

# or multiply by coefficients giving same result
coef(y.lm) %*% c(1, tail(y,1))

# Now try it using quantile regression
library(quantreg)
y.rq <- dyn$rq(y ~ lag(y,-1))
tail(predict(y.rq, list(y = y)), 1)
coef(y.rq) %*% c(1, tail(y,1))

On 5/15/06, Kerpel, John <[EMAIL PROTECTED]> wrote:
> All:
>
>
>
> How do I obtain one step ahead out-of-sample forecasts from a model
> using "dyn" or "dynlm" ?
>
>
>
> Thanks!
>
>
>
> Best,
>
>
>
> John
>
>
>
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> [email protected] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to