Holt-Winters Forecasting App

Danielle Boucher
Apr 30 2017

Introduction to Holt-Winters Forecasting

Holt-Winters is a triple exponential smoothing model that is particularly useful when forecasting time series data with seasonal patterns. There are three key model parameters:

  1. Alpha: Smoothing Factor
  2. Beta: Trend Factor
  3. Gamma: Seasonal Smoothing Factor

You can learn more about Holt-Winters forecasting and it's usefulness to seasonal profiles here:

https://stat.ethz.ch/R-manual/R-devel/library/stats/html/HoltWinters.html

Generating a Holt-Winters Model in R

We can use the HoltWinters() command on time series data to generate a fitted model.

weeklytrend <- ts(training$Sales, start = c(2014, 1), frequency = 52)
hw <- HoltWinters(weeklytrend)
head(hw$fitted,2)
Time Series:
Start = c(2015, 1) 
End = c(2015, 2) 
Frequency = 52 
             xhat    level     trend    season
2015.000 1039.806 1076.749 -1.330867 -35.61283
2015.019 1017.918 1064.092 -1.330867 -44.84264

Forecasting with Holt-Winters

Once we have fitted a Holt-Winters model, we can use the “forecast” package to extend our predictions out “h” number of time periods.

forecast1 <- forecast(hw, level = 90, h=52)
plot(forecast1, ylab="Volume", xlab="Year", main="Holt-Winters Forecast")

plot of chunk unnamed-chunk-3

Interactive Parameter Selection with our Web App

In our above example, we did not specify the alpha, beta, and gamma for the Holt-Winters model - we let the model select the optimized values. However, we do not always want to use the mathematically optimized values, as the output may not be realistic. Our web app allows you to select the model parameters in real time using sliders, and see the results on your data.

Check it out here! https://dboucher.shinyapps.io/holtwintersforecast/

Source code and documentation here: https://github.com/dboucher6/dataproductsfinal