【问题标题】:Forecasting Daily Data using HoltWinters使用 HoltWinters 预测每日数据
【发布时间】:2017-07-31 18:33:29
【问题描述】:

首先,我已经咨询过这个articlethis,但无法让它发挥作用。

我有从28-03-201527-02-2017 的每日数据。 我的TS object 看起来像这样:

bvg11_prod_ts <- ts(bvg11_data$MA_PROD, freq=365, start=c(2015, 87), end=c(2017, 58))

下图显示了每日数值:

autoplot(bvg11_prod_ts)

我也尝试过通过以下方式创建每日 ts 对象:

bvg11_prod_ts <- ts(bvg11_data$MA_PROD, freq=7, start=c(2015, 3), end=c(2017, 02))
autoplot(bvg11_prod_ts)

这导致了这个情节:

如您所见,两张图完全不同,但第一个更准确!

现在当我尝试使用bvg11_prodsTSHoltWinter &lt;- HoltWinters(bvg11_prod_ts) 时出现错误:

Error in decompose(ts(x[1L:wind], start = start(x), frequency = f), seasonal) : time series has no or less than 2 periods

怎么了?

【问题讨论】:

  • 你的系列的长度是多少?

标签: r time-series prediction holtwinters


【解决方案1】:

错误信息非常清楚:频率为 365 时,您至少需要 2*365 = 730 个数据点。

x_err = ts(runif(729), freq = 365)
# this gives an error
fit = HoltWinters(x_err)

# this will work
x = ts(runif(730), freq = 365)
fit = HoltWinters(x)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-11-30
    • 1970-01-01
    • 2018-01-03
    • 1970-01-01
    • 2021-05-02
    • 2019-05-11
    • 2020-07-12
    • 1970-01-01
    相关资源
    最近更新 更多