NonlinearSSM#

class cultivars.state_space.nonlinear.NonlinearSSM(transition, observation, *, state_cov, obs_cov, initial_state, initial_state_cov, transition_sampler=None, observation_loglik=None, observed_transition=None)[source]#

A nonlinear (and optionally non-Gaussian) state-space model.

The additive-Gaussian core is:

y_t = g(alpha_t) + eps_t,      eps_t ~ N(0, R)
alpha_{t+1} = f(alpha_t) + eta_t,   eta_t ~ N(0, Q)

with \(f\) and \(g\) arbitrary batched maps: each takes a (n, m) block of states and returns (n, m) or (n, p) rows, which is what lets sigma points and particle clouds move through them without Python loops. Three filters read it, in increasing generality and decreasing exactness-of-assumptions: the extended filter linearizes \(f\) and \(g\) by central-difference Jacobians; the unscented filter propagates deterministic sigma points (Julier-Uhlmann), exact through linear maps and third-order accurate through smooth ones; the particle filter (bootstrap, or auxiliary in the Pitt-Shephard form) makes no smoothness or Gaussianity assumption at all and returns an unbiased likelihood estimate rather than a likelihood.

Non-Gaussian models enter through two hooks. transition_sampler replaces the additive-Gaussian state draw, and observation_loglik replaces the Gaussian measurement density – a stochastic-volatility model, whose measurement noise is multiplicative, is the canonical customer. A model carrying either hook is outside the additive form, so the extended and unscented filters refuse it rather than linearizing an assumption that no longer holds; the particle filter is the honest tool there, and the refusal says so.

Missing observations are numpy.nan rows: every filter skips the update and carries the prediction, matching the linear substrate’s convention.

See also

Attributes#

is_additive_gaussian

Whether the model is in the additive-Gaussian form all filters accept.

k_endog

Observation dimension.

k_states

State dimension.

Methods#

extended_filter(y)

The extended Kalman filter: linearize, then filter exactly.

extended_smoother(y)

The extended Rauch-Tung-Striebel smoother.

particle_filter(y, *[, n_particles, method, ...])

Sequential Monte Carlo: the filter that assumes nothing smooth.

particle_smoother(y, *[, n_particles, ...])

Forward-filtering backward-smoothing (Doucet-Godsill-Andrieu).

unscented_filter(y, *[, alpha, beta, kappa])

The unscented Kalman filter: deterministic sigma points, no Jacobians.

unscented_smoother(y, *[, alpha, beta, kappa])

The unscented Rauch-Tung-Striebel smoother.