我正在使用R中的HTS包来评估层次结构中执行销售预测的最佳级别。
我遇到的问题是,当使用tdfp执行预测时(所以自上而下使用bottom forecast来分解)。其余的模型工作正常。
非常感谢您的帮助
重新构造的步骤:我得到的错误均值是:
"Error en rowsum.default(flist[[j + 1L]], repcount) : incorrect length for 'group'"重现错误的文件可以在(希望它能工作,我不是专家)中找到:https://github.com/memdux/hts_error.git
要重现该错误,可以使用以下代码:
require("forecast")
require("hts")
dates_input= read.csv("test_data_dates.csv",sep =";", dec = ".")
soh= read.csv("test_data_values.csv",sep =";", dec = ".")
soh_matrix = as.matrix(soh)
ts_soh = ts(soh_matrix,
start=c(2012, 01),
end=c(2015, 01),
frequency=12)
y <- hts(ts_soh, characters = c(2, 3, 4, 3, 5))
train = window(y, start = c(2012,1), end = c(2014, 9))
test = window(y, start = c(2014,10), end = c(2015, 1))
fcst_hts_3 = forecast.gts(train, h = 4, method = "tdfp", fmethod = "arima")
# Same error if using forecast (no gts) and / or ets as forecast method发布于 2017-08-14 10:13:35
我在hts v5.1.4中也遇到了这个问题。似乎TdFp函数不喜欢characters参数中的通用顶级标签。在我的例子中,所有标签都以"R03“开头,characters参数以c(3,2,...)开头。当我从标签中删除此子字符串并将characters参数更改为c(2,...)一切都运行得很好。
在第一种情况下,hts的对象变量有:
$ nodes:List of 5
..$ Level 1: int 1
..$ Level 2: 'table' int[1(1d)] 10
...
$ labels: List of 6
..$ Level 0: chr "Total"
..$ Level 1: chr "R03"而在第二种情况下是:
$ nodes :List of 4
..$ Level 1: int 10
..$ Level 2: 'table' int [1:10(1d)] 5 4 4 4 ...
...
$ labels :List of 5
..$ Level 0: chr "Total"
..$ Level 1: chr [1:10] "AC" "AK" "AL" "BA" ...https://stackoverflow.com/questions/36682560
复制相似问题