[英]Forecasting Daily Data using HoltWinters
我的每日數據從28-03-2015
年3月27-02-2017
日到28-03-2015
年2月27-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 <- 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
怎么了?
錯誤消息非常清楚:頻率為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.