Holt Winters method example

By | May 31, 2015

From time to time people have asked me how to implement Holt Winters (trend-seasonal exponential smoothing) in Excel. Let me start by saying that although Excel is probably the most common forecasting tool in business, it is also not a good one. It does not provide many useful options and tools and there is plenty of space for mistakes.

I have produced a small example of Holt Winters that you can download. It comes with two options, depending on how the initial values are calculated. The first option is using a simple heuristic, while the second requires finding optimal initial values with solver.

Two words of caution: i) Excel’s optimiser can easily get stuck to local minima, so try to start with reasonable starting values; ii) Do not use Holt-Winters method when you do not have trend-seasonal data. Instead prefer the simpler Holt or Single Exponential Smoothing methods.

You can download the example spreadsheet here.

My personal view is that organisations should invest in expertise in forecasting and appropriate systems. There are multiple benefits to be gained by accurate and robust forecasts. A relatively inexpensive solution is using R. Several forecasting related packages exist. Prof. Rob Hyndman maintains the excellent forecast package that includes a state-of-the art exponential smoothing implementation. Alternatively you can consider the TStools package that includes a very flexible exponential smoothing implementation by Ivan Svetunkov, amongst other useful forecasting tools and methods (like the Theta method) or try the MAPA package, which implements the Multiple Aggregation Prediction Algorithm that has demonstrated very good performance relatively to exponential smoothing.

17 thoughts on “Holt Winters method example

  1. anthony iannarelli

    Hello Professor Kourentzes – How would you handle the calculations if a variable is zero? You have two formulas that divide either by “Level” or by “Season” I have some data that would make these zero. FDor not I used an if statement and declared that formula’s result to be zero.

    Any advise would be appreciated.

    Thank you,

    Anthony

    Reply
    1. Nikos Post author

      Unfortunately Holt-Winters does not handle zeros well, because of the multiplicative interaction between level and season. Typically there are two ways forward, none of which is perfect.

    2. The simplest one is to replace the zero values with something else, perhaps the average value for the period in the season from other years, or linearly interpolate from the neighbouring points.
    3. The other option is to switch to an additive form of trend-seasonal exponential smoothing, instead of Holt-Winters. The formulas now become somewhat different and instead of dividing you need to subtract and instead of multiplying you need to add. This way the zero values are no longer a problem. You can find both additive and multiplicative forms here.
    4. Having said that, if your seasonality is really multiplicative then switching to the additive exponential smoothing will not be ideal.

      Hope this helps!
      Nikos

      Reply
  2. mario

    I have tried the first option, to estimate business sales of my company for 2016, a medium size company with strong seasonality, due to the fact that it sell products for building sector. Monthly sales usually range from 400K€ in AUgust (lowest point) to 1,2 MILLIOn €(high peaks) in other months (July, MAy)… the pattern is pretty almost the same, considering last 4 years.
    Although this, forecast for 2016 is clearly overestimated… do you think that is a problem of fixing smoothing parameters for level, trend and season?
    Have a good day
    Greetings from Italy

    Reply
    1. Nikos Post author

      Hi Mario,
      I think your assessment sounds reasonable. If the forecasts looks unreasonably highthen I would seuspect it might be something with the smoothing parameters of the level and the trend (and perhaps the initial values, if these are not optimised). A good heuristic is to set a low alpha (smoothing parameter for level) first and then proceed to the rest of the parameters. Did you optimise the parameters or set them manually?
      Nikos

      Reply
  3. mario

    Well to be honest I have substituted my monthly sales values and then applied all the formulas inserted in the “first option- excel sheet”. The results are not that far in the In –sample-period and follow quite well the seasonality of our business. Regarding forecast for 2016 , the seasonality is good, but monthly estimates are clearly overestimated , in average of +50%.
    So I have tried to lower level parameter (from 0,51 to 0,38) keeping trend and season parameter constant and it improves. But the question is: is this scientific? I do not think so. Do you have a more scientific approach to balance the model?

    Thanks for help.. never faced this model during my economics studies.

    Reply
    1. Nikos Post author

      I presume that the 0.51 was the result of the optimisation? Perhaps then it is a problem with the initial values and optimising all would be better (see option 2, the recommended one). However the optimisation in Excel is rather weak, so it may not be able to get good parameters at all for some time series. A very practical approach is to just not allow some parameters to become very high (for example restrict alpha, the level smoothing parameter to < = 0.2). A final point to make is that optimisation using MSE will not always be able to give you good forecasts! There is ongoing work (see this post) to make the optimisation better and more reliable.

      Reply
  4. mario

    OOops .. I have forgotten to minimize the MSE. I have just done it with the excel solver and effectively MSE is minimized and parameters become LEVEL 0,17, Trend 1 and Season 0,30. The forecast for the In- sample period fits even better than before and the forecast for the out-sample period (2016) is now acceptable (just +5% against my personal forecast).
    Now I will try the second option. Thanks so much for this model. I think is pretty important to extend quantitative forecast analysis even for small/medium size company, like mine.
    Thanks for help

    Reply
  5. Ignacio Boix

    Hi Nikolas,
    I’m working in implementing a Sales forecast tool with your Excel file (option 2). It is delivering good results. I’m preparing the Slides to present it to senior management and I have a doubt.
    Is this file based on multiplicative Holt-winters or additive?. I have read the comments and seems that it is a multiplicative one, but not sure

    Many thanks

    Reply
    1. Nikos Post author

      It is the multiplicative version. Good luck with your presentation!
      Best,
      Nikos

      Reply
  6. Dev

    Hello Dr. Kourentzes,

    Let me thank you very much for taking the time to post this informative article.

    I have simulated the Holt Winter model listed above and a few other models. (eg: Holt, Holt Winters, Linear Regression etc). One of the challenges I faced in all of these models is when trying to minimize MAPE or MAD by optimizing the smoothing parameters is that Excel returns extreme values (for eg: Alpha = 1, Beta = 1, Gamma =.45).

    I would like to ask you 2 questions:
    1. I believe this is due to the fact that the Excel model is solely focused exclusively on reducing MAPE & MAD, based on ex-post forecast. Therefore for example, it gives very high weightage to recent forecasts. Is this the reason? If so, how can we overcome it?

    2. Does variance of the order history affect the above phenomenon?

    Reply
    1. Nikos Post author

      It depends on the data that you are using. The effect of high parameters is to give very high weighting to recent periods, but it is not the reason for the optimisation results. On the other hand the variance of the order history will be driving this. Let me give you an example. Suppose let’s say that you have a very well behaved demand pattern and at some point sales jump to a new level. Without the jump the optimiser would typically prefer low parameters. The jump will cause your optimiser to shift parameters towards higher values, because this way it will be able to minimise on average errors for all past sales (the type of error squared error/absolute error/etc. will affect the exact solution, but the behaviour will be similar). In fact increasing the parameter values may not be necessary, as that jump in sales happened in the past and we still care about appropriately smoothing sales after the jump. A similar effect may be caused by promotions (depending how many there are and how much is the uplift). What does that mean in practice? Two things: (i) although optimisation is a great way to get model parameters automatically, it is not guaranteed to work best all the time; and (ii) we should override results that do not make much sense!

      One more point that you may find helpful: optimising on squared errors will try to minimise any extreme errors, so it will focus on such jumps in sales or promotions. On the other hand optimising on mean absolute error will focus more on the sales baseline. Typically we use squared errors (MSE), but absolute errors/deviation (MAE/MAD) is also reasonable. MAPE on the other hand is a bad idea, as it does not weight positive and negative errors equally. The division by the actual sales at each period may cause additional problems!

      Reply
  7. Dev

    I realize from the above comments that you have proposed that we restrict the values by placing bounds on them. Is there a better method? I did peruse the article you had mentioned as a response to Mario’s comments, but I was not able to understand them.

    Is there a possibility that you could explain it in layman’s terms?

    – Thank You

    Reply
  8. Ashley

    Hello, I really appreciate for your excel file!
    But, I have a question about parameter, alpha, beta and gamma.

    How can I find them using excel, matlab or whatever??

    Thank you!

    Reply
    1. Nikos Post author

      Hi Ashley,
      In the example file I calculate the in-sample Mean Squared Error (MSE – cell B10 in either options). Use solver to minimise this, by changing the cells that contain the smoothing parameters (cells B4:B6 in option 1 or cells B13:B29 in option 2). In MATLAB or R you would use the same logic. You would fit the model with some initial smoothing parameters and values and calculate the in-sample MSE. Then you would minimise that by asking some optimiser to change the smoothing parameters. Finally note that other errors could be used instead of MSE, but this is one of the most common.
      Nikos

      Reply
  9. Marietta

    Hello Mr. Nikos,

    Could you please suggest me a book that it can help me to understand the meaning of the method’s results in Excel?

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *