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, *, converged, iterations, objective_trace, termination_reason)[source]
Bases:
objectFitted univariate linear-Gaussian state-space model and smoothed latent path.
The reported
loglikis bound toobjective_trace[-1]and theconvergedverdict is bound totermination_reason: a receipt that can state a final objective unrelated to the trace it came from, or a verdict unrelated to the rule that stopped the loop, is not evidence (MXR-080-1897). The smoothed path and its standard deviations are copied and sealed, so neither the caller’s arrays nor a later write through the result can rewrite geometry that was validated at construction.- summary()[source]
Return fitted dynamics, noise scales, initialization, and log likelihood.
- statespace_fit(rv, data, *, how='auto', max_its=200, tol=None, delta=1e-8, missing='error', backend='local', num_workers=None, engine=None, precision=None, print_iter=0, **unknown)[source]
Fit a
LocalLevelorAR1state-space expression by Kalman EM.