按月数据的 Holt-Winters
在视频中,您学到 hw() 函数会使用 Holt-Winters 方法进行预测,具体形式由 seasonal 参数的取值决定:
fc1 <- hw(aust, seasonal = "additive")
fc2 <- hw(aust, seasonal = "multiplicative")
这里,您将把 hw() 应用于 a10,它是 1991 到 2008 年澳大利亚抗糖尿病药物的月度销量。数据已在您的工作区中可用。
本练习是课程的一部分
R 中的预测
练习说明
- 绘制
a10数据的时间图。 - 使用带乘法季节性的
hw()为未来 3 年生成预测,并将结果保存到fc。 - 残差看起来像白噪声吗?使用合适的函数进行检验,并将
whitenoise设为TRUE或FALSE。 - 绘制预测结果的时间图。
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Plot the data
___
# Produce 3 year forecasts
fc <- hw(___, seasonal = ___, h = ___)
# Check if residuals look like white noise
___
whitenoise <- ___
# Plot forecasts
___