我想要一个将回归量合并到 forecast.hts 中的示例/方法。下面似乎是正确的,但可惜没有产生预测。
require(hts)
data(htseg2)
ri <- runif(14)
rix <- runif(16)
htseg2y <- hts(window(allts(htseg2),start = c(1992), end=c(2005))[,8:17],htseg2$g)
htseg2x <- hts((window(allts(htseg2),start = c(1992), end=c(2005))*ri)[,8:17],htseg2$g)
htseg2nx <- hts((window(allts(htseg2),start = c(1992), end=c(2007))*rix)[,8:17],htseg2$g)
forecast.hts(htseg2y , h = 2, fmethod = c("arima"), positive = F, stepwise=F,ic=c("bic"),level=4,trace=TRUE
,xreg = allts(htseg2x)
,newxreg = allts(htseg2nx))