← All 31 animations

Statsmodels STL wrapper

Statsmodels STL wrapper

Property Value
Method STL
Input mode univariate
Trend shape (96,)
Notebook execution ran
Reconstruction RMSE 0.00000000

Notebook example metric: root mean square of input - (trend + season + residual) over all samples and channels. This checks additive bookkeeping; it is not a forecast error or a component-recovery score. The separate teaching input and intermediate arrays for the animation are linked below.

How it works

Method maturity: stable. Implementation: wrapper.

STL alternates local seasonal and trend smoothing while retaining a residual component.

STL: Form seasonal-phase subseries; Use local polynomial smoothing; Alternate seasonal and trend; Form the additive result

Deterministic synthetic teaching signal; not a benchmark.

Open GIF · Static PNG · Source arrays (NPZ) · Trace metadata

Follow the four steps

1. Form seasonal-phase subseries

After removing the current trend, collect values at the same phase in successive cycles. STL smooths along each of these subseries, allowing the seasonal pattern to vary through the record.

2. Use local polynomial smoothing

The illustrative panel computes a tricube-weighted local linear fit for one phase. Full STL also extends boundaries, applies low-pass filtering, and combines the smoothed subseries; the illustration is not a replacement implementation of those internals.

3. Alternate seasonal and trend

The seasonal estimate is subtracted to form a deseasonalized series, which is smoothed for trend. The numerical checkpoints come from exact statsmodels fits with one through five inner iterations and no outer robustness loop.

4. Form the additive result

The final five-iteration checkpoint matches the configured DeTime STL wrapper. Residual is the input minus the returned trend and seasonal component. Reconstruction consistency does not validate a unique physical interpretation.

Parameters that change the result

Parameter Effect on the computation
period Specified number of samples in a seasonal cycle; this example uses 12.
seasonal Odd LOESS span across cycles for the seasonal subseries; smaller spans allow faster seasonal change.
trend / low_pass Odd smoothing spans controlling trend and low-pass behavior; this example uses 23 and 13.
robust Controls the outer reweighting loop. ROBUST_STL defaults to True; setting it False disables robustness.

What this animation computes

The local weighted regression illustrates LOESS numerically and omits STL's full low-pass and boundary machinery. Exact statsmodels inner-iteration checkpoints and final DeTime output are shown separately and compared.

Interpretation

  • ROBUST_STL is the registry name for statsmodels STL with its robust option. This name does not establish implementation of other published algorithms also called RobustSTL.
  • Smoothing spans, seasonal period, endpoint handling, and outliers influence the estimated components.
  • The animation uses statsmodels' actual checkpoints. Internal fits are restarted for each budget; frame count is not an execution-time measure.
  • STL is an offline smoother. Use only available history when constructing forecasting features.

Try the method

Use this configuration with DecompositionConfig and decompose. The animation generator supplies the teaching input and records intermediate arrays.

{
  "method": "STL",
  "backend": "python",
  "params": {
    "period": 12,
    "seasonal": 7,
    "trend": 23,
    "low_pass": 13,
    "robust": false
  }
}

See the configuration reference for the full interface and optional dependencies.

Sources and reproduction

Regenerate this animation with python scripts/generate_method_animations.py --methods STL. The reproduction guide explains the environment, numerical checks, coverage manifest, and how to inspect the stored arrays.

Code

case = CASES["STL"]
run_gallery_case("STL")

Output

Decomposition Plot

STL decomposition