Skip to content

Cannot get fitted values with STLForecast #7464

@eyalshafran

Description

@eyalshafran

I'm trying to get the fitted values when using STLForecast. I cannot get fitted values when using STLForecast with multiplication terms (error or trend).

Here is a code to reproduce the problem:

from sktime.datasets import load_airline
from sktime.forecasting.model_selection import temporal_train_test_split
from statsmodels.tsa.exponential_smoothing.ets import ETSModel
from statsmodels.tsa.forecasting.stl import STLForecast

y = load_airline()
y_train, y_test = temporal_train_test_split(y, test_size=36)

fit = STLForecast(y_train,
                    ETSModel,
                    period=12,
                    model_kwargs={'error':'mul'}).fit()

fit.get_prediction(start=0,end=107).predicted_mean

If I replace the error to 'add' in this example the code works.

INSTALLED VERSIONS

Python: 3.8.5.final.0
OS: Darwin 20.3.0 Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64 x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8

statsmodels

Installed: 0.12.2 (/opt/anaconda3/lib/python3.8/site-packages/statsmodels)

Required Dependencies

cython: 0.29.21 (/opt/anaconda3/lib/python3.8/site-packages/Cython)
numpy: 1.18.4 (/opt/anaconda3/lib/python3.8/site-packages/numpy)
scipy: 1.4.1 (/opt/anaconda3/lib/python3.8/site-packages/scipy)
pandas: 1.0.3 (/opt/anaconda3/lib/python3.8/site-packages/pandas)
dateutil: 2.8.1 (/opt/anaconda3/lib/python3.8/site-packages/dateutil)
patsy: 0.5.1 (/opt/anaconda3/lib/python3.8/site-packages/patsy)

Optional Dependencies

matplotlib: 3.3.2 (/opt/anaconda3/lib/python3.8/site-packages/matplotlib)
backend: module://ipykernel.pylab.backend_inline
cvxopt: Not installed
joblib: 0.17.0 (/opt/anaconda3/lib/python3.8/site-packages/joblib)

Developer Tools

IPython: 7.19.0 (/opt/anaconda3/lib/python3.8/site-packages/IPython)
jinja2: 2.11.2 (/opt/anaconda3/lib/python3.8/site-packages/jinja2)
sphinx: 3.2.1 (/opt/anaconda3/lib/python3.8/site-packages/sphinx)
pygments: 2.7.2 (/opt/anaconda3/lib/python3.8/site-packages/pygments)
pytest: 6.1.1 (/opt/anaconda3/lib/python3.8/site-packages/pytest)
virtualenv: 20.4.3 (/opt/anaconda3/lib/python3.8/site-packages/virtualenv)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions