简体   繁体   中英

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 . My TS object looks like this:

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:

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:

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.

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM