Back to models
Forecaster

StatsForecastMSTL

StatsForecast Multiple Seasonal-Trend decomposition using LOESS model.

Direct interface to statsforecast.models.MSTL, from statsforecast [1] by Nixtla, with a back-adapter that allows to use sktime forecasters as trend forecasters.

The MSTL (Multiple Seasonal-Trend decomposition using LOESS) decomposes the time series in multiple seasonalities using LOESS. Then forecasts the trend using a custom non-seasonal model (trend_forecaster) and each seasonality using a SeasonalNaive model. MSTL requires the input time series data to be univariate.

Quickstart

python
from sktime.forecasting.statsforecast import StatsForecastMSTL

estimator = StatsForecastMSTL(season_length: int | list [int ], trend_forecaster=None, stl_kwargs: dict | None=None, pred_int_kwargs: dict | None=None)

Parameters(4)

season_lengthUnion[int, List[int]]
Number of observations per unit of time. For multiple seasonalities use a list.
trend_forecasterestimator, optional, default=StatsForecastAutoETS()
Sktime estimator used to make univariate forecasts. Multivariate estimators are not supported.
stl_kwargsdict, optional

Extra arguments to pass to [statsmodels.tsa.seasonal.STL]

(https://www.statsmodels.org/dev/generated/statsmodels.tsa.seasonal.STL.html#statsmodels.tsa.seasonal.STL). The period and seasonal arguments are reserved.

pred_int_kwargsdict, optional

Extra arguments to pass to [statsforecast.utils.ConformalIntervals].

Examples

>>> from sktime.datasets import load_airline
>>> from sktime.forecasting.statsforecast import StatsForecastMSTL
>>> y = load_airline ()
>>> model = StatsForecastMSTL (season_length = [3, 12 ])
>>> fitted_model = model. fit (y = y)
>>> y_pred = fitted_model. predict (fh = [1, 2, 3 ])

References