R HTS 包中的 Combinef - 原始级别名称丢失

Combinef in R HTS package - Original Level Names lost

当使用 combinef() 组合预测时,生成的 hts 时间序列具有类似于 A、AA、AB 的级别名称...它不保留提供的 hts 时间序列中的级别名称。

在下面的示例中,底层名称为 "A10A" & "A10B",而生成的底层名称为 "AA"、"BB".

有没有办法在组合预测对象中保留原始级别名称?

library(forecast)
library(hts)

abc <- ts(5 + matrix(sort(rnorm(20)), ncol = 2, nrow = 10))
colnames(abc) <- c("A10A", "A10B")
y <- hts(abc, characters = c(3, 1))


h <- 12
ally <- aggts(y)
allf <- matrix(NA, nrow = h, ncol = ncol(ally))
for(i in 1:ncol(ally))
  allf[,i] <- forecast(auto.arima(ally[,i]), h = h)$mean
allf <- ts(allf)
y.f <- combinef(allf, get_nodes(y), weights = NULL, keep = "gts", algorithms = "lu")

在代码末尾添加以下行:

colnames(allf) <- colnames(ally)
colnames(y.f$bts) <- colnames(y$bts)
y.f$nodes <- y$nodes
y.f$labels <- y$labels