Hello everybody!
I have a problem when I try to perform a forecast of an ARIMA model
produced by an auto.arima function. Here is what I'm doing:
c<-auto.arima(fil[[1]],start.p=0,start.q=0,start.P=0,start.Q=0,stepwise=TRUE,stationary=FALSE,trace=TRUE)
# fil[[1]] is time series of monthly data
ARIMA(0,0,0)(0,1,0)[12] with drift : 1725.272
ARIMA(0,0,0)(0,1,0)[12] with drift : 1725.272
ARIMA(1,0,0)(1,1,0)[12] with drift : 1694.301
ARIMA(0,0,1)(0,1,1)[12] with drift : 1e+20 *
ARIMA(1,0,0)(0,1,0)[12] with drift : 1729.999
ARIMA(1,0,0)(2,1,0)[12] with drift : 1693.12
ARIMA(1,0,0)(2,1,1)[12] with drift : 1e+20 *
ARIMA(0,0,0)(2,1,0)[12] with drift : 1693.804
ARIMA(2,0,0)(2,1,0)[12] with drift : 1690.714
ARIMA(2,0,1)(2,1,0)[12] with drift : 1e+20 *
ARIMA(3,0,1)(2,1,0)[12] with drift : 1e+20 *
ARIMA(2,0,0)(2,1,0)[12] : 1705.069
ARIMA(2,0,0)(1,1,0)[12] with drift : 1698.130
ARIMA(2,0,0)(2,1,1)[12] with drift : 1e+20 *
ARIMA(3,0,0)(2,1,0)[12] with drift : 1688.896
ARIMA(4,0,1)(2,1,0)[12] with drift : 1e+20 *
ARIMA(3,0,0)(2,1,0)[12] : 1700.064
ARIMA(3,0,0)(1,1,0)[12] with drift : 1701.519
ARIMA(3,0,0)(2,1,1)[12] with drift : 1e+20 *
ARIMA(4,0,0)(2,1,0)[12] with drift : 1e+20
Best model: ARIMA(3,0,0)(2,1,0)[12] with drift
# this is the output of the function
fore<-forecast(c,h=12)
# and this is the error
Error en predict.Arima(object, n.ahead = h, newxreg = xreg) :
'xreg' and 'newxreg' have different numbers of columns
This error only occurs when the output of the auto.arima function contanis
drift.
Any help is aprecciated!!!!
[[alternative HTML version deleted]]
For what its worth, I am having the same issue. Specifically, I am using R
2.8.1 on Windows XP, applying auto.arima to the data from the
http://www.neural-forecasting-competition.com/datasets.htm NN5 forecasting
competition , series NN-101 through NN-111. The relevant code is
library(RODBC)
channel <-
odbcConnectExcel("NN5_FINAL_DATASET_WITH_TEST_DATA.xls")
alldata <- sqlFetch(channel, "NN5 COMPLETE Data")
odbcClose(channel)
series <- alldata[17:751,102:112]
actualWithdrawls <- alldata[752:807,102:112]
fit <- auto.arima(series[,i], stationary=FALSE, ic="aic",
max.p=12,
max.q=3, stepwise=TRUE)
tmp = predict(fit, n.ahead=56)
forecast = tmp$pred
As habby reported, every time the optimal model found includes drift, the
call to predict results in
Error in predict.Arima(fit, n.ahead = 56) :
'xreg' and 'newxreg' have different numbers of
columns
I have found other threads on this same issue with no responses. I am a
fairly new R user, so maybe there is something basic I am doing
incorrectly...
I found some interesting, seemingly relevant discussion
http://www.stat.pitt.edu/stoffer/tsa2/Rissues.htm here but have yet to
digest it all.
My basic problem is how to set up auto.arima to be as automated as possible.
I had written a for loop to crunch through all of the series in from the NN5
competition and experiment with different auto.arima settings and compare
out of sample forecast accuracy. But, having run into this issue, its
unclear what the cause is and if/how it can be avoided.
Thanks for any ideas.
--
View this message in context:
http://www.nabble.com/forecasting-issue-tp21585746p22775817.html
Sent from the R help mailing list archive at Nabble.com.