使用傅立叶项对具有多个季节性的时间序列进行建模时,如何在xreg中添加虚拟变量

时间:2019-07-10 13:25:20

标签: r

我正在尝试预测每日通话次数。拥有每日数据(从2015年开始),显示每周和每年的季节性。

我尝试了带有ARIMA错误的动态谐波回归。该模型大大降低了银行假期的电话预测数量,因此我创建了一些虚拟变量:新年,五月初的银行假期,圣诞节等。但这是行不通的。

ft <- fourier(calls, K=c(3,10))

model1<- auto.arima(calls, seasonal=FALSE, lambda=0,
                xreg=cbind(ft, NY, GoodFriday, EasterMonday,EarlyMayBH, 
                     SpringBH,ChristmasEve, ChristDay, BoxingDay, NYEve))

model1_forc <- forecast(model1, 
                   xreg=cbind(ft,
                              NY=c(1,0,0,0,0,0,0,0,0,0,0,0,0,0), 
                              GoodFriday=c(0,0,0,0,0,0,0,0,0,0,0,0,0,0), 

EasterMonday=c(0,0,0,0,0,0,0,0,0,0,0,0,0,0),
                              EarlyMayBH=c(0,0,0,0,0,0,0,0,0,0,0,0,0,0),
                              SpringBH=c(0,0,0,0,0,0,0,0,0,0,0,0,0,0),

ChristmasEve=c(0,0,0,0,0,0,0,0,0,0,0,0,0,0),
                              ChristDay=c(0,0,0,0,0,0,0,0,0,0,0,0,0,0),
                              BoxingDay=c(0,0,0,0,0,0,0,0,0,0,0,0,0,0),
                              NYEve=c(0,0,0,0,0,0,0,0,0,0,0,0,0,0)))




autoplot(model1_forc)
summary(model1_forc)

我得到了预测,但不是很好。

0 个答案:

没有答案