Loading tsb runtime…

← back to tsb playground

Exponential Smoothing (ETS / Holt-Winters)

Simple Exponential Smoothing, Holt linear trend, and full Holt-Winters seasonal models. Mirrors statsmodels.tsa.holtwinters.ExponentialSmoothing.

1 — Simple Exponential Smoothing (SES)

SimpleExpSmoothing fits ETS(A,N,N): level-only smoothing with parameter α. All h-step forecasts equal the final level. α is estimated by minimising SSE via Nelder-Mead.

JavaScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

2 — Holt's Linear Trend (Double Exponential Smoothing)

Holt extends SES with a trend component β (ETS(A,A,N)). Optionally damps the trend with φ (ETS(A,Ad,N)) to prevent over-shooting.

JavaScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

3 — Holt-Winters Additive Seasonal

ExponentialSmoothing with trend: "add" and seasonal: "add" models data with a linear trend plus additive seasonal fluctuations. Classic Holt-Winters ETS(A,A,A).

JavaScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

4 — Holt-Winters Multiplicative Seasonal

Use seasonal: "mul" when the amplitude of seasonal swings grows with the level (common in economic time series). ETS(A,A,M).

JavaScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

5 — Forecast with prediction intervals

forecastWithCI(steps, alpha) returns point forecasts plus (1 − α) % prediction intervals. Intervals widen with forecast horizon.

JavaScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

6 — Model selection via AIC/BIC

Compare SES, Holt, and Holt-Winters using information criteria. Lower AIC/BIC indicates a better balance of fit and parsimony.

JavaScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

7 — Known initialisation and fixed parameters

You can supply fixed smoothing parameters or initial state values. Use initializationMethod: "known" to set the initial state directly without estimating it.

JavaScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent