[R] Testing predictive power of ARIMA model

Evan DeCorte evandec at gwu.edu
Sat Dec 13 03:18:24 CET 2008

I am trying to make estimates of the predictive power of ARIMA models estimated by the auto.arima() function. 

I am looping through a large number of time seiries and fitting ARIMA models with the following code. 

data1 <- read.csv(file = "case.csv", header = T)
data <- data1

output = c(1:length(data))

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. 

I tried including something like this:

output[i] = cor(model_data, real_data)

but with poor results.

Does anyone have any tricks to calculate the R^2 or an ARIMA model. Sample code would be apreciated.

More information about the R-help mailing list