我've been trying to forecast some variables based on 3 years of past data at a monthly level where the seasonality is 12 months I'使用 stl( )
函数来分解时间序列对象:
fit <- stl(data.ts, t.window=12, s.window="periodic", robust=TRUE)
其中'data.ts'是时间序列对象,然后使用以下方法预测未来12个月:
f<- forecast(fit,method="naive",h=12)
由于某些外部事件在历史数据中没有出现,这几个月预测不足 . 我想知道在我的时间序列预测中是否有任何方法可以捕获此类事件
1 回答
您可以从预测包中尝试auto.arima或arima函数 . 您可以在xreg参数中使用带有外部变量的df
检查一下:https://www.otexts.org/fpp/9/1