[R] n step ahead forecasts

Weiwei Shi helprhelp at gmail.com
Wed Jan 24 22:59:12 CET 2007


Dear Spencer:

just my2cent:
could you change the step from 1 to m, like 5 if you have a very large
validation set. I have a feeling that it won't change too much about
the result but I am not sure what your endpoint is.

weiwei

On 1/24/07, sj <ssj1364 at gmail.com> wrote:
> hello,
>
> I have a question about making n step ahead forecasts in cases where test
> and validation sets are availiable. For instance, I would like to make one
> step ahead forecasts  on the  WWWusage data so I hold out the last 10
> observations as the validation set and fit an ARIMA model on the first 90
> observations. I then use a for loop to sequentially add 9 of the holdout
> observations to make 1 step ahead forecasts for the last 10 periods (see
> example code). In cases where there are relatively few periods I want to
> forecast for this seems to work fine, however I am working with a rather
> large validation set and I need to make n step ahead forecasts for many
> periods and it takes a very long time. Is there a more efficient way to do
> this?
>
>
>
> vset <- WWWusage[91:100]
>
> pred <-c()
> for (i in 0:9)
>     { fit <-arima(WWWusage[1:(90+i)],c(3,1,0))
>       p<- predict(fit,se.fit=F)
>       pred <- c(pred, p)
>     }
> plot(pred,type="o",col=2)
> lines(vset,type="o",col=1)
>
>
> thanks,
>
> Spencer
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>


-- 
Weiwei Shi, Ph.D
Research Scientist
GeneGO, Inc.

"Did you always know?"
"No, I did not. But I believed..."
---Matrix III



More information about the R-help mailing list