【问题标题】:gts() from hts package: How to create strictly hierarchical time series, in order to apply the top down hierarchical forecasting methodhts 包中的 gts():如何创建严格分层的时间序列,以便应用自上而下的分层预测方法
【发布时间】:2020-04-15 09:36:05
【问题描述】:

我有兴趣应用自上而下的方法,如下所示 https://otexts.com/fpp2/top-down.html

y <- ts(matrix(rnorm(900),ncol=45,nrow=20))
blnames <- paste(c(rep("A",20),rep("B",25)), # State
                 rep(1:9,each=5), # County
                 rep(c("X","X","X","Y","Y"),9), # Industry
                 rep(c("a","b","c","a","b"),9), # Sub-industry
                 sep="")
colnames(y) <- blnames
gy <- gts(y, characters=list(c(1,1),c(1,1)))

gps <- rbind(
  c(rep(1,20),rep(2,25)), # State
  rep(1:9,each=5), # County
  rep(c(1,1,1,2,2),9), # Industry
  rep(1:5, 9), # Sub-industry
  c(rep(c(1,1,1,2,2),4),rep(c(3,3,3,4,4),5)), # State x industry
  c(rep(1:5, 4),rep(6:10, 5)), # State x Sub-industry
  rep(1:18, rep(c(3,2),9)) # County x industry
)

gy <- gts(y, groups=gps)
forecast(gy, method="tdgsa", fmethod="arima")# top down gross sohl method a

我一直试图弄清楚如何定义严格的层次结构,但似乎没有关于如何创建一个的示例。 尝试应用自顶向下方法时,我会收到以下错误。

> forecast(gy, method="tdgsa", fmethod="arima")# top down gross sohl method a
Error: Argument method is not appropriate for a non-hierarchical time series.

【问题讨论】:

    标签: r time-series hierarchical-data forecasting


    【解决方案1】:

    解决方案是使用 hts(),而不是使用 gts()。

    【讨论】:

      猜你喜欢
      • 2021-12-04
      • 2015-05-02
      • 2014-10-26
      • 2019-05-21
      • 2016-07-12
      • 1970-01-01
      • 2015-04-24
      • 2021-10-26
      • 1970-01-01
      相关资源
      最近更新 更多