Loading tsb…

← tsb playground

Dynamic Linear Models

Combine a local level, trend, or Fourier seasonality in a state-space model. Filter observations, smooth the historical states, and forecast with prediction intervals.

1 · Filter and smooth a local level

A missing observation skips the measurement update; smoothing uses later observations to refine earlier estimates.

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

2 · Forecast a trend

A local linear trend has a level and slope state. Forecast intervals include state and observation uncertainty.

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

3 · Combine trend and seasonality

Add Fourier components to a trend, then estimate noise variances by maximum likelihood.

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