statsmodels.tsa.api.ExponentialSmoothing update 0.11.1 -> 0.14

58 views
Skip to first unread message

Evgeny L

unread,
Aug 15, 2023, 8:36:45 AM8/15/23
to pystatsmodels
I try to update a project from statsmodels 0.11.1 to 0.14. There were some changes in ExponentialSmoothing which impede me.
In 0.11.1 I used

mdl = ExponentialSmoothing(**{'trend': 'add', 'seasonal': None, 'endog': ts})
fit_mdl = mdl.fit(use_brute=True, initial_level=ts.iloc[0])

I try to use backward compatible constructor setting initialization_method to None. Though in documentation initial_level should be provided in constructor it doesn't allow it raising `{ValueError}initialization method is None but initial_level has been set.`
My new version use:

ExponentialSmoothing(**{'trend': 'add', 'seasonal': None, 'endog': ts, 'initialization_method': None, 'initial_level': ts.iloc[0]})
fit_mdl = mdl.fit()

Even if I change source code of /statsmodels/tsa/holtwinters/model.py:
        if initial_level is not None or initial_trend is not None:
            raise ValueError(
                "Initial values were set during model construction. These "
to
        if (initial_level is not None or initial_trend is not None) and self._initialization_method   is not None:
            raise ValueError(
                "Initial values were set during model construction. These "

Then the results of fit and forecast are different. In some cases for 38 long actual data I receive difference more than 16% on 15th forecast point.
My goal is to make backward compatibility, to get approximately the same results that were previously +-5% for forecasting 30-40 points forward.

The second question is trend property.
It didn't exist previously and I calculated it via
     fit_mdl.level + fit_mdl.slope
In new version there is no property .slope but there is .trend. As I didn't manage with correct initialization described before I can't say whether trend equals level + slope.
But what I get now is very different like x10 times difference
Reply all
Reply to author
Forward
0 new messages