Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/83.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 如何对具有2个级别的hts对象进行自上而下的预测比例?_R_Time Series_Forecasting_Hierarchical - Fatal编程技术网

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我不知道你在说什么,我没有编辑这个问题,也没有现成的答案,因为我一年多前问过这个问题。如果我找到了解决方案,我通常会自己回答,所以很可能一年前我也没有答案。