[英]Forecasting Daily Data using HoltWinters
First of all I have already consulted this article and this but couldn't get it to work. 首先,我已经咨询了这个文章和这个 ,但不能让它开始工作。
I have daily data starting from 28-03-2015
till 27-02-2017
. 我的每日数据从
28-03-2015
年3月27-02-2017
日到28-03-2015
年2月27-02-2017
。 My TS object
looks like this: 我的
TS object
看起来像这样:
bvg11_prod_ts <- ts(bvg11_data$MA_PROD, freq=365, start=c(2015, 87), end=c(2017, 58))
the below graph shows the daily values: 下图显示了每日值:
autoplot(bvg11_prod_ts)
I have also tried creating the daily ts object by: 我还尝试通过以下方式创建每日ts对象:
bvg11_prod_ts <- ts(bvg11_data$MA_PROD, freq=7, start=c(2015, 3), end=c(2017, 02))
autoplot(bvg11_prod_ts)
which results in this plot: 结果在这个图中:
As you can see both graphs are completely different, however, the first one is more accurate! 如您所见,两个图完全不同,但是第一个更准确!
Now when i try to use the bvg11_prodsTSHoltWinter <- HoltWinters(bvg11_prod_ts)
It gives error: 现在,当我尝试使用
bvg11_prodsTSHoltWinter <- 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
What is wrong? 怎么了?
The error message is pretty clear: with a frequency of 365 you'll need at least 2*365 = 730 data points. 错误消息非常清楚:频率为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)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.