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

R HTS包中的Combinef-原始级别名称丢失,r,time-series,forecasting,r-hts,R,Time Series,Forecasting,R Hts,使用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) <-

使用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")
库(预测)
图书馆(hts)

abc在代码末尾添加以下行:

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

colnames(allf)非常感谢它的工作。节点已正确填充,因此跳过
y.f$Nodes似乎没有问题