繁体   English   中英

tidyverts 中的分层建模/协调问题

[英]Problems with hierarchical modelling/reconciliation in tidyverts

我正在尝试按照Rob Hyndman 的 Rstudio.conf 研讨会的方式进行分层预测,但遇到了一些问题。 这是我的代码:

library(dplyr)
library(tsibbledata)
library(tsibble)
library(fable)

aus_retail_2013_tr <- aus_retail %>%
    filter(Month <= yearmonth("2013 Dec"))
aus_retail_2013_vl <- aus_retail %>%
    filter(Month > yearmonth("2013 Dec"))

hmod <- aus_retail_2013_tr %>%
    aggregate_key(State*Industry, Turnover=sum(Turnover)) %>%
    model(ar=ARIMA(log(Turnover))) %>%
    reconcile(ar_adj=min_trace(ar))

fcasts_hmod <- forecast(hmod, aus_retail_2013_vl)

fcasts_hmod %>%
    filter(is_aggregated(Industry), State == "Victoria") %>%
    autoplot()

plot 的 output 如下。

在此处输入图像描述

我的主要问题是:

  • 和解实际上似乎根本没有改变预测。 图片表明arar_adj行是相同的。
  • 预测仅适用于 2014 年至 2015 年的时间段,而我知道完整的数据集到 2018 年。

我该如何解决这些问题? 后一个可能是因为并非所有时间序列都涵盖整个时期,但我怎样才能reconcile不跳过缺失的时期?

这是 dplyr 0.8.5、fable 0.2.0、fabletools 0.1.3 和 tsibble 0.8.6。 我在 Ubuntu/R 3.6.3 和 Windows 10/R 4.0.0 上得到了相同的结果。

PS。 尝试对固定范围进行预测会导致错误:

> fcasts_hmod <- forecast(hmod, h="5 years")
Error: Reconciliation of non-normal forecasts is not yet supported.
Run `rlang::last_error()` to see where the error occurred.

这些问题是错误(或者更多的是当前对帐实施的 scope)。 您可以通过包的 BugReports URL ( https://github.com/tidyverts/fabletools/issues ) 报告这些问题。

我的主要问题是:

和解实际上似乎根本没有改变预测。 图片表明 ar 和 ar_adj 行是相同的。

预测仅适用于 2014 年至 2015 年的时间段,而我知道完整的数据集到 2018 年。

协调模型的预测应该有错误,这是开发版本中的当前行为。 请注意,您的forecast() new_data参数包含 148 个时间序列,但您正在从 181 个模型生成预测。 这是因为请求的预测仅适用于底层系列( aus_retail_2013_vl尚未汇总)。

PS。 尝试对固定范围进行预测会导致错误:

 Error: Reconciliation of non-normal forecasts is not yet supported. Run `rlang::last_error()` to see where the error occurred.```

这是因为您的 model 具有对数转换的响应变量,该变量在进行反向转换时会产生具有对数正态分布的预测。 概率预测协调很困难,目前仅针对正态分布实施。 我将添加对点预测的协调作为后备( https://github.com/tidyverts/fabletools/issues/216 )。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM