0

I want to use the level and slope in Holt Winters in statsmodels because for each period I want to generate a forecast with timelag (steps) higher than one. That is, for each period I want to generate a forecast three periods ahead.

I see that I can do:

demand = pd.DataFrame({'material': [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
                   'quantity': [32118, 32129, 32648, 33115, 34214, 34449, 36282, 
                                36674, 38320, 40229, 41702, 42320, 42595, 42969, 
                                44462, 44365, 44652, 45169, 45388, 46499, 46497]})

model = models.Holt(demand['quantity'], damped=True)
fit = model.fit(smoothing_level=0.1,
            smoothing_slope=0.2,
            damping_slope=0.9,
            optimized=False)

From fit, I can do fit.level and fit.slope. It is quite strange that with these values I cannot generate the forecast.

I expect that slope and level at least start with the same value found in fit.params. For this example, fit.params has initial slope 9.9 and initial level 32118. Nevertheless, when I look into fit.level, the first value is 32126.91 for the level and 9.7 for the slope.

Any idea how to extract the level and slope that is used by fit.predict()?

hiragar
  • 1
  • 1

1 Answers1

1

See https://github.com/statsmodels/statsmodels/pull/5893, there is a bug in the case of a damped trend.

cfulton
  • 2,855
  • 2
  • 14
  • 13