R 如何对具有2个级别的hts对象进行自上而下的预测比例?
我之前曾要求尝试使用R 如何对具有2个级别的hts对象进行自上而下的预测比例?,r,time-series,forecasting,hierarchical,R,Time Series,Forecasting,Hierarchical,我之前曾要求尝试使用hts包获取自上而下的预测比例预测重组。那里的解决方案对于多级层次结构非常有效,但是我发现当我尝试在两级层次结构上使用该解决方案时,出现了一个错误 library(hts) # Create the hierarchy newhts <- hts(htseg1$bts, list(ncol(htseg1$bts))) # forecast creation adapted from the `combinef()` example h <- 12 ally <
hts
包获取自上而下的预测比例预测重组。那里的解决方案对于多级层次结构非常有效,但是我发现当我尝试在两级层次结构上使用该解决方案时,出现了一个错误
library(hts)
# Create the hierarchy
newhts <- hts(htseg1$bts, list(ncol(htseg1$bts)))
# forecast creation adapted from the `combinef()` example
h <- 12
ally <- aggts(newhts)
allf <- matrix(NA, nrow = h, ncol = ncol(ally))
for(i in 1:ncol(ally))
allf[,i] <- forecast(auto.arima(ally[,i]), h = h, PI = FALSE)$mean
allf <- ts(allf, start = 51)
# Earo Wang's solution to my previous question
hts:::TdFp(allf, nodes = htseg1$nodes)
库(hts)
#创建层次结构
正如您所看到的,这是TdFp
函数中的一个bug。我还没有找到解决这个问题的方法。谢谢。我刚刚意识到解决方法只是删除allf@marbel我不知道你在说什么,我没有编辑这个问题,也没有现成的答案,因为我一年多前问过这个问题。如果我找到了解决方案,我通常会自己回答,所以很可能一年前我也没有答案。