mixle.ppl.statespace module
Linear-Gaussian state-space models for mixle.ppl (Kalman filter + RTS smoother + EM).
A univariate latent state evolves as x_t = phi * x_{t-1} + w_t (w ~ N(0, q)) and is
observed as y_t = x_t + v_t (v ~ N(0, r)). LocalLevel() fixes phi = 1 (a
random walk + noise / trend smoother); AR1() estimates phi. Fitting is EM: the
E-step is the Kalman/RTS smoother, the M-step updates phi, q, r.
-
class StateSpaceResult(phi, q, r, x0, P0, smoothed, smoothed_var, loglik)[source]
Bases: object
Fitted univariate linear-Gaussian state-space model and smoothed latent path.
-
forecast(h)[source]
Point forecasts h steps ahead from the last smoothed state.
- Parameters:
h (int)
-
summary()[source]
Return fitted dynamics, noise scales, initialization, and log likelihood.
-
statespace_fit(rv, data, *, max_its=200, tol=1e-6, **_)[source]
Fit a LocalLevel or AR1 state-space expression by Kalman EM.
- Parameters:
rv (RandomVariable)
max_its (int)
tol (float)
- Return type:
RandomVariable