0
我正在閱讀我的hts包。我有興趣嘗試自定義預測部分,該部分需要使用指定的預測功能遍歷每個系列。所提供的例子顯示偶數組。我想知道如何運行具有不平衡數量的組的自定義預測,然後將它們重新組合到gts對象中。分層預測(hts包)R不均勻羣體和自定義預測
bts <- ts(5 + matrix(sort(rnorm(500)), ncol=5, nrow=100))
y <- hts(bts, nodes=list(2, c(3, 2)))
allts_y <- aggts(y)
allf <- matrix(allts_y, nrow=100, ncol=ncol(allts_y))
for(i in 1:ncol(allts_y))
allf[,i] <- forecast(auto.arima(allts_y[,i]), h=10)$mean
allf <- ts(allf, start=1)
# below code is where I run into a hang-up
g <- matrix(c(rep(2, 5), rep(3, 5), rep(1:5, 2)), nrow = 2, byrow = T)
y.f <- combinef(allf, groups = g)
謝謝你,海德曼博士。我現在看到兩個數據對象之間的差異以及我想如何將一個方形的釘子安裝到一個圓孔中。我一定會在將來區分組和節點。 – user2300643