[R] Testing predictive power of ARIMA model
Evan DeCorte
evandec at gwu.edu
Sat Dec 13 21:07:01 CET 2008
Thanks for the great feedback. Conceptually I understand how you would go about testing out of sample performance. It seems like accuracy() would be the best way to test out of forecast performance and will help to automate the construction of statistics I would have calculated on my own.
However, the real question now is how do you loop through a time series and automatically split a time series into training and testing sets. I know how I would do it for individual sets but to do so manually over a large number of time series seems excessively burdensome.
> > for(i in 1:length(data))
> > {
> > point_data = unlist(data[i], use.names = FALSE)
> > x = auto.arima(point_data , max.p = 10, max.q = 10, max.P = 0,
> max.Q = 0, approximation = TRUE)
> >
> > }
> >
> > However, I would like to find a way to test the out of sample
> predictive power of these models. I can think of a few ways I MIGHT be
> able to do this but nothing clean. I am a recen R user and despite my
> best efforts (looking on the mailing list, reading documentation) I
> cant figure out the best way to do this.
> >
> >
> if you want to test the predictive power you need a prediction. so at
> least you need predict(x) in your loop and to store the predictions in
> another variable. Afterwards you can calculate several measures.
>
> another way is to use the dm.test and accuracy functions of the
> forecast(ing) package which you might already have used for the auto arima.
>
> one remark: the use of auto arima might not be the best solution since
> it uses in sample fit measures (e.g. AIC) for the best in sample fit.
> So
> for every i you might have a very different arima class. I am not sure
> whether this is what you intented...
>
> hth
> Stefan
More information about the R-help
mailing list