预测中的xReg无法正常工作

时间:2018-06-28 12:30:02

标签: r

我正在使用Arima预测购物中心的人流量

fitArima <- arima(fitTS, order = c(1,1,0),seasonal = c(0,0,0),method="ML",xreg = modelReg)
fitArimaForecast<-forecast(fitArima,h=7,xreg = forecastReg)

fitTS的值

Jan     Feb     Mar     Apr     May     Jun     Jul     Aug     Sep     Oct
2013  753485  839924 1170962 1382132 1179204 1105744  924768 1085683 1049808 1053584
2014  769780  802925 1091115 1080203 1221206 1147603 1196187 1178577 1147709 1277989
2015  946135  913238 1023579 1092299 1145395 1098304 1049607 1123351  851105 1131733
         Nov     Dec
2013 1175159 1360388
2014 1302668 1501674
2015  936506 1104098

modelReg的值

[1]  2.832258  2.882143  2.525806  7.803333 11.103226 14.620000 18.858065 17.416129
 [9] 14.010000 18.616129  7.436667  7.077419  5.893333  6.507692  7.819355 10.506667
[17] 12.722581 15.613333 18.345161 15.083871 14.810000 12.441935  8.710000  5.945161
[25]  4.990323  4.978571  6.670968  9.680000 11.012903 14.513333 15.714286 16.630000
[33] 12.712500 11.038710  9.390000  9.441935

ForecastReg的值

5.732258  5.227586  6.274194  7.386667 12.293548 14.856667 16.905882

我遇到以下错误

Error in eval(expr, envir, enclos) : object 'modelReg' not found

但是当我使用auto.arima时,它工作正常

fitAutoArima<-auto.arima(fitTS,xreg = modelReg)
fitAutoArimaForecast<-forecast(fitAutoArima,periodValue,xreg = forecastReg)

0 个答案:

没有答案