简体   繁体   English

Auto.Arima预测中的差异预测器

[英]Difference Predictors in Auto.Arima Forecast

I'm trying to build an auto.arima forecast with predictors like the example below. 我正在尝试使用类似以下示例的预测变量来构建auto.arima预测。 I've noticed that my predictor is non-stationary. 我注意到我的预测器是不稳定的。 So I was wondering if I should difference the predictor before inputting it in the xreg parameter, like I've shown below. 因此,我想知道是否应该在xreg参数中输入预测变量之前对其进行区分,如下所示。 The real data set is much larger, this just an example. 实际数据集要大得多,这只是一个例子。 Any advice is greatly appreciated. 任何意见是极大的赞赏。

Code: 码:

tsTrain <-tsTiTo[1:60]
tsTest <- tsTiTo[61:100]

ndiffs(ds$CustCount)
##returns 1

diffedCustCount<-diff(ds$CustCount,differences=1)

Xreg<-diffedCustCount[1:100]

##Predictor
xregTrain2 <- Xreg[1:60]
xregTest2 <- Xreg[61:100]


Arima.fit2 <- auto.arima(tsTrain, xreg = xregTrain2)

Acast2<-forecast(Arima.fit2, h=40, xreg = xregTest2)

Data: 数据:

dput(ds$CustCount[1:100])

c(3, 3, 1, 4, 1, 3, 2, 3, 2, 4, 1, 1, 5, 6, 8, 5, 2, 7, 7, 3, 2, 2, 2, 1, 3, 2, 3, 1, 1, 2, 1, 1, 3, 2, 2, 2, 3, 7, 5, 6, 8, 7, 3, 5, 6, 6, 8, 4, 2, 1, 2, 1, NA, NA, 4, 2, 2, 4, 11, 2, 8, 1, 4, 7, 11, 5, 3, 10, 7, 1, 1, NA, 2, NA, NA, 2, NA, NA, 1, 2, 3, 5, 9, 5, 9, 6, 6, 1, 5, 3, 7, 5, 8, 3, 2, 6, 3, 2, 3, 1 ) c(3,3,1,4,4,1,3,2,3,2,4,1,1,5,6,8,8,5,7,7,7,2,2,2,2,1, 3、2、3、1、1、2、1、1、3、2、2、2、3、7、5、6、8、7、3、5、6、6、8、4、2 1,2,1,NA,NA,4,2,2,4,11,2,8,1,4,7,11,5,3,10,7,1,1,NA,2,NA, NA,2,NA,NA,1、2、3、5、9、5、9、6、6、1、5、3、7、5、8、3、2、6、3、2、3, 1)

dput(tsTiTo[1:100])

c(45, 34, 11, 79, 102, 45, 21, 45, 104, 20, 2, 207, 45, 2, 3, 153, 8, 2, 173, 11, 207, 79, 45, 153, 192, 173, 130, 4, 173, 174, 173, 130, 79, 154, 4, 104, 192, 153, 192, 104, 28, 173, 52, 45, 11, 29, 22, 81, 7, 79, 193, 104, 1, 1, 46, 130, 45, 154, 153, 7, 174, 21, 193, 45, 79, 173, 45, 153, 45, 173, 2, 1, 2, 1, 1, 8, 1, 1, 79, 45, 79, 173, 45, 2, 173, 130, 104, 19, 4, 34, 2, 192, 42, 41, 31, 39, 11, 79, 4, 79) c(45,34,11,79,102,45,21,45,104,20,2,207,45,2,3,153,8,2,173,11,207,79,45,153, 192,173,130,4,173,174,173,130,79,154,4,104,192,153,192,104,28,173,52,45,11,29,22,81,7, 79、193、104、1、1、46、130、45、154、153、7、174、21、193、45、79、173、45、153、45、173、2、1、2、1 1,8,1,1,79,45,79,173,45,2,173,130,104,19,4,34,2,192,42,41,31,39,11,79,4, 79)

The xreg argument in auto.arima performs a dynamic regression which is to say that you are performing a linear regression and fitting the errors with an arma process. 所述xreg在参数auto.arima执行dynamic regression这是说您正在执行线性回归,并用装配误差arma过程。

While auto.arima() used to require manual differencing for non-stationary data when external regressors are included, this is no longer the case. 当包含外部回归变量时, auto.arima()曾经要求对非平稳数据进行手动差异处理,但现在不再如此。 auto.arima() will take non-stationary data as an input and determine the order of differencing using a unit-root test. auto.arima()会将非平稳数据作为输入,并使用单位根测试确定差异的顺序。

See this Post from Rob Hyndman for further detail. 有关更多详细信息,请参见Rob Hyndman的这篇文章

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM