[R] n step ahead forecasts

From: sj <ssj1364_at_gmail.com>
Date: Wed 24 Jan 2007 - 18:48:59 GMT


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@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. Received on Thu Jan 25 16:04:46 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 25 Jan 2007 - 05:30:29 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.