# Implementation Difference between HoltWinters and hw functions of R's forecast package

While searing for examples for implementing Holtwinters with R, I came across following two functions:

1. hw function from forecast package
2. HoltWinters function from R-Core

For the same data set, forecasting done by above mentioned functions are different. What is the reason behind this difference?

HoltWinters() implements exponential smoothing along the lines you will find in any description, e.g., Wikipedia or Forecasting: Principles and Practice. Note how smoothing parameters and initial values are chosen (?HoltWinters):

The function tries to find the optimal values of alpha and/or beta and/or gamma by minimizing the squared one-step prediction error if they are ‘NULL’ (the default).

For seasonal models, start values for ‘a’, ‘b’ and ‘s’ are inferred by performing a simple decomposition in trend and seasonal component using moving averages (see function ‘decompose’) on the ‘start.periods’ first periods (a simple linear regression on the trend component is used for starting level and trend). For level/trend-models (no seasonal component), start values for ‘a’ and ‘b’ are ‘x[2]’ and ‘x[2] - x[1]’, respectively.

In contrast, quoting from ?hw,

ses, holt and hw are simply convenient wrapper functions for forecast(ets(...)).

And ets() fits a state space model, as per FPP2 and Hyndman, R.J., Akram, Md., and Archibald, B. (2008) "The admissible parameter space for exponential smoothing models". Annals of Statistical Mathematics, 60(2), 407-426. One difference therefore is how the transition matrices in the state space model (which correspond to the smoothing constants) are chosen and how the initial values are set.

An additional difference is that state space models will allow calculating predictive densities and s, in contrast to the earlier ad-hoc exponential smoothing methods (which are forecasting methods, not statistical time series models, although point forecasts may be the same).

• Nov 9, 2017 at 12:15