生成包括先知和时间聚集(小偷)在内的长期预测 [英] Generating long-term forecasts including prophet and temporal aggregation (thief)

查看:62
本文介绍了生成包括先知和时间聚集(小偷)在内的长期预测的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始使用 {fable} {tidyverts} 系列工具,到目前为止一切进展顺利.

I just started to use {fable} and the {tidyverts} family of tools and so far it's going quite well.

我目前有兴趣根据每日数据(每月或每季度的分辨率较好或更可取)生成长期的概率预测.我的理解是,时间汇总可以帮助减少模型的不确定性,还可以将已知的每日影响(尤其是假日影响)传播到例如季度级别,并以此方式提高准确性.

I'm currently interested in producing long term probabilistic forecasts from daily data (with a monthly or quarterly resolution being fine or preferred). My understanding is, that temporal aggregation could help reduce model uncertainty and also propagate known daily influences (especially holiday effects) to the e.g. quarterly level and improve accuracy that way.

对于我计划使用先知+协变量的每日数据,对于较高的总计(每月至每年),指数平滑似乎是合适的.

For the daily data I plan on using prophet + covariates, for the higher aggregates (monthly to yearly) exponantial smoothing seems appropriate.

虽然我想知道这种方法是否总体上很有希望,但我不确定如何使用 {thief} 构造预测问题以得出概率预测.

While I wonder if this approach seems generally promising, I am not quite sure how to structure the forecast problem using {thief} to arrive at probabilistic forecasts.

PS:我发现此有用的每小时数据帖子,但是在为每日数据实现它时遇到了麻烦(例如,创建有意义的汇总并合并预测):

PS: I found this helpful post for hourly data, but I'm running into problems implementing it for daily data (e.g. creating meaningful aggregations and combining the forecasts): https://stats.stackexchange.com/questions/352121/how-to-forecast-hourly-as-well-as-daily-data-in-r

推荐答案

要使用 {thief} 生成概率预测,您需要将寓言转换为 {forecast} 样式预测对象. precast 对象的基本最小结构(以及如何从寓言分布中产生它,可以通过 {fable.prophet} 获得给先知):/p>

To produce probabilistic forecasts using {thief} you'll need to convert the fable into a {forecast} style forecast object. The basic minimal structure of a forecast object (and how it can be produced from a fable distribution, which can be obtained for prophet via {fable.prophet}) is:

library(forecast)
library(distributional)
dist <- dist_normal(1:10)

structure(
  list(
    # A time series of the forecast means
    mean = ts(mean(dist)),
    # A matrix time series of the forecast interval's upper bound
    upper = ts(cbind("80%" = quantile(dist, 0.90), "95%" = quantile(dist, 0.975))),
    # A matrix time series of the forecast interval's lower bound
    lower = ts(cbind("80%" = quantile(dist, 0.10), "95%" = quantile(dist, 0.025))),
    # A vector containing forecast interval levels in order of appearance
    level = c(80, 95)
  ),
  class = "forecast"
)
#>    Point Forecast      Lo 80     Hi 80       Lo 95     Hi 95
#>  1              1 -0.2815516  2.281552 -0.95996398  2.959964
#>  2              2  0.7184484  3.281552  0.04003602  3.959964
#>  3              3  1.7184484  4.281552  1.04003602  4.959964
#>  4              4  2.7184484  5.281552  2.04003602  5.959964
#>  5              5  3.7184484  6.281552  3.04003602  6.959964
#>  6              6  4.7184484  7.281552  4.04003602  7.959964
#>  7              7  5.7184484  8.281552  5.04003602  8.959964
#>  8              8  6.7184484  9.281552  6.04003602  9.959964
#>  9              9  7.7184484 10.281552  7.04003602 10.959964
#> 10             10  8.7184484 11.281552  8.04003602 11.959964

reprex软件包(v0.3.0)创建于2020-12-10 sup>

Created on 2020-12-10 by the reprex package (v0.3.0)

然后可以将这些预测结构与 thief :: reconcilethief()结合使用.

You can then use these forecast structures with thief::reconcilethief() to reconcile them.

也就是说,目前正在为 {fable} 开发时间(和跨时间)对帐.相关的开发问题在这里: https://github.com/tidyverts/fabletools/issues/59尚未实现将每日或子每日时间性与月度和年度层次结构进行协调的复杂性,但是目前该原型对于>每月底部级别而言都运行良好.最近在ISF2020上的演讲介绍了与 {fable} 的时间协调:

That said, temporal (and cross-temporal) reconciliation is currently being developed for {fable}. The relevant development issue is here: https://github.com/tidyverts/fabletools/issues/59 There are some complexities with reconciling daily or sub-daily temporal to monthly and annual hierarchies which have not yet been implemented, but the prototype currently works well for >monthly bottom levels. This recent presentation at ISF2020 introduces temporal reconciliation with {fable}: https://www.youtube.com/watch?v=6D7rNHZ5E-Q&t=1120

值得注意的是,来自 {thief} 的间隔仅仅是来自更高时间频率的间隔之和.这些间隔不是最佳的,因此将不同于 {fable} 给出的最佳概率预测分布.

It's worth noting that the intervals from {thief} are simply the sum of intervals from higher temporal frequencies. These intervals are not optimal, and so will differ from the optimal probabilistic forecast distributions that will be given by {fable}.

这篇关于生成包括先知和时间聚集(小偷)在内的长期预测的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆