Holt-Winters method with daily data
The Holt-Winters method can also be used for daily type of data, where the seasonal pattern is of length 7, and the appropriate unit of time for h
is in days.
Here, you will compare an additive Holt-Winters method and a seasonal naive()
method for the hyndsight
data, which contains the daily pageviews on the Hyndsight blog for one year starting April 30, 2014. The data are available in your workspace.
This exercise is part of the course
Forecasting in R
Exercise instructions
- Using
subset.ts()
, set up a training set where the last 4 weeks of the available data inhyndsight
have been omitted. - Produce forecasts for these last 4 weeks using
hw()
and additive seasonality applied to the training data. Assign this tofchw
. - Produce seasonal naive forecasts for the same period. Use the appropriate function, introduced in a previous chapter, and assign this to
fcsn
. - Which is the better of the two forecasts based on RMSE? Use the
accuracy()
function to determine this. - Produce time plots of these forecasts.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Create training data with subset()
train <- subset(___, end = ___)
# Holt-Winters additive forecasts as fchw
fchw <- hw(___, seasonal = ___, h = ___)
# Seasonal naive forecasts as fcsn
fcsn <- ___
# Find better forecasts with accuracy()
accuracy(___, ___)
accuracy(___, ___)
# Plot the better forecasts
autoplot(___)