1
我正在嘗試在GTS對象使用ARIMA模型迴歸時,此錯誤:ARIMA模型預測的分層數據迴歸
錯誤...傅立葉(X,K,長度(X)+( 1:h)): K不得大於period/2
下面是一段簡單的重複性代碼。我應該怎樣設置k?我嘗試過不同的價值觀,但似乎沒有任何工作。
library(hts)
y3 <- ts(matrix(rnorm(300),ncol=60,nrow=5))
blnames3 <- paste0(rep(c("CA", "NY"), each = 30), # State
rep(c("AL", "LA", "CL", "ES"), each = 15), # County
rep(c("O", "O", "O", "C", "C"), 12), # Industry
rep(c("p", "q", "r", "p", "q"), 12), # Sub-industry
rep(504:507, 15)) # Product
colnames(y3) <- blnames3
gy3 <- gts(y3, characters=list(c(2,2),c(1,1,3)))
i=5
fc <- forecast(gy3, fmethod="arima", seasonal=FALSE, h=6, xreg=fourier(gy3, K=i), newxreg=fourierf(gy3, K=i, h=6))
對不起,通過添加i更正了代碼。 gts來自hts包 - https://cran.r-project.org/web/packages/hts/hts.pdf – jjreddick
您的時間系列還需要頻率屬性。 –