Now instead of passing arguments to the function you chain functions to the Holt-Winters object.
So to give a concrete example, let’s take the monthly UK fish landing data from the ONS. I’ve stitched data from 2008 to 2015 together and filtered on just the amount landed in the UK by both UK and foreign vessels.
To perform the Holt-Winters exponential smoothing we first create a foreHoltWinter() object. Then we pass the parameters and data to the object via some methods/functions.
var fhw = ssci.fore.holtWinter() .data(data) .period(12) .level(.14) .trend(0) .season(0);
After this the function needs to be called:
To get the output you can then use:
This will return an array of forecast points. To forecast further you use the forecast(value) function where value is the number of time periods ahead that you wish to forecast for. More detail is on the page for the function itself, including the other functions that can be called to control more aspects of the analysis.
Putting this all together, here is an example using the data specified previously. I’ve added the forecast data on this chart and predicted forwards for 12 months.