我正在尝试按时间序列训练Arima模型以及一周中每小时的xreg预测器。然后我试着预测接下来30个小时的模型。对于预测,我需要30小时的预测变量。所以我尝试在下面的两次尝试中使用季节性函数中的h = 30,但在两种情况下我都得到相同的错误消息。如果有人能用我的代码指出问题,或建议如何实现这一点,我将不胜感激。
代码:
library("forecast")
x=ts(tsData,freq=168)
xregT<-seasonaldummy(x)
xregV<-seasonaldummy(x,30)
seasonaldummy(x,30)中的错误:未使用的参数(30)
Arima.fit<-Arima(tsData, lambda = -0.1803477, xreg=xregT, order=c(17,1,0), seasonal = FALSE)
Acast<-forecast(Arima.fit, xreg=seasonaldummy(x,30), h=30)
seasonaldummy(x,30)中的错误:未使用的参数(30)
更新
xregV&lt; -seasonaldummyf(x,30)##诀窍
数据:
dput(tsData)
c(11,14,17,5,5,5.5,8,NA,5.5,6.5,8.5,4,5,9,10,11, 7,6,7,7,5,6,9,9,6.5,9,3.5,2,15,2.5,17,5,5.5, 7,6,3.5,6,9.5,5,7,4,5,4,9.5,3.5,5,4,4,9,4.5, 6,10,NA,9.5,15,9,5.5,7.5,12,17.5,19,7,14,17,3.5, 6,15,11,10.5,11,13,9.5,9,7,4,6,15,5,18,5,6,19, 19,6,7,7.5,7.5,7,6.5,9,10,5.5,5,7.5,5,4,10,7, 5,12,6,NA,4,2,5,7.5,11,13,7,8,7.5,5.5,7.5,15, 7,4.5,9,3,4,6,17.5,11,7,6,7,4.5,4,4,5,10,14 7,7,4,7.5,11,6,11,7.5,15,23.5,8,12,5,9,10,4,9, 6,8.5,7.5,6,5,8,6,5.5,8,11,10.5,4,6,7,10,11.5, 11.5,3,4,16,3,2,2,8,4.5,7,4,8,11,6.5,7.5,17,6, 6.5,9,12,17,10,5,5,9,3,8.5,11,4.5,7,16,11,14, 6.5,15,8.5,7,6.5,11,2,2,13.5,4,2,16,11.5,3.5,9, 16.5,2.5,4.5,8.5,5,6,7.5,9.5,NA,9.5,8,2.5,4,12, 13,10,4,6,16,16,13,8,12,19,19,5.5,8,6.5,NA,NA, NA,15,12,NA,6,11,8,4,2,3,4,10,7,5,4.5,4,5,11.5, 12,10.5,4.5,3,4,7,15.5,9.5,NA,9.5,12,13.5,10,10, 13,6,8.5,15,16.5,9.5,14,9,9.5,11,15,14,5.5,6,14, 16,9.5,23,NA,19,12,5,11,16,8,11,9,13,6,7,3,5.5, 7.5,19,6.5,5.5,4.5,7,8,7,10,11,13,NA,12,1.5,7, 7,12,8,6,9,15,9,3,5,11,11,8,6,3,7.5,4,7,7.5, NA,NA,NA,NA,6.5,2,16.5,7.5,8,8,5,2,7,4,6.5,4.5, 10,6,4.5,6.5,9,2,6,3.5,NA,5,7,3.5,4,4.5,13,19, 8.5,10,8,13,10,10,6,13.5,12,11,5.5,6,3.5,9,8,NA, 6,5,8.5,3,12,10,9.5,7,24,7,9,11.5,5,7,11,6,5.5, 3,4.5,4,5,5,3,4.5,6,10,5,4,4,9.5,5,7,6,3,13, 5.5,5,7.5,3,5,6.5,5,5.5,6,4,3,5,NA,5,5,6,7,8, 5,5.5,9,6,8.5,9.5,8,9,6,12,5,7,5,3.5,4,7.5,7, 5,4,4,NA,7,5.5,6,8.5,6.5,9,3,2,8,15,6,4,10,7, 13,14,9.5,9,18,6,5,4,6,4,11.5,17.5,7,8,10,4,7, 5,9,6,5,4,8,4,2,1.5,3.5,6,5.5)