SteadyStateFilter#

class pymc_experimental.statespace.filters.SteadyStateFilter(mode=None)[source]#

Kalman Filter using Steady State Covariance

This filter avoids the need to invert the covariance matrix of innovations at each time step by solving the Discrete Algebraic Riccati Equation associated with the filtering problem once and for all at initialization and uses the resulting steady-state covariance matrix in each step.

The innovation covariance matrix will always converge to the steady state value as T -> oo, so this filter will only have differences from the standard approach in the early steps (T < 10?). A process of “learning” is lost.

__init__(mode=None)#

Kalman Filter.

Parameters:

mode (str, optional) – The mode used for Pytensor compilation. Defaults to None.

Notes

The BaseFilter class is an abstract base class (ABC) for implementing kalman filters. It defines common attributes and methods used by kalman filter implementations.

mode#

The mode used for Pytensor compilation.

Type:

str or None

seq_names#

A list of name representing time-varying statespace matrices. That is, inputs that will need to be provided to the sequences argument of pytensor.scan

Type:

list[str]

non_seq_names#

A list of names representing static statespace matrices. That is, inputs that will need to be provided to the non_sequences argument of pytensor.scan

Type:

list[str]

eye_states#

An identity matrix of shape (k_states, k_states), stored for computational efficiency

Type:

TensorVariable

eye_posdef#

An identity matrix of shape (k_posdef, k_posdef), stored for computational efficiency

Type:

TensorVariable

eye_endog#

An identity matrix of shape (k_endog, k_endog), stored for computational efficiency

Type:

TensorVariable

Methods

__init__([mode])

Kalman Filter.

add_check_on_time_varying_shapes(data, ...)

Insert a check that time-varying matrices match the data shape to the computational graph.

build_graph(data, a0, P0, c, d, T, Z, R, H, Q)

Need to override the base step to add an argument to self.update, passing F_inv at every step.

check_params(data, a0, P0, c, d, T, Z, R, H, Q)

Apply any checks on validity of inputs.

handle_missing_values(y, Z, H)

This function handles missing values in the observation data y and adjusts the design matrix Z and the observation noise covariance matrix H accordingly.

initialize_eyes(R, Z)

Initialize identity matrices for of shapes repeated used in the kalman filtering equations and store them.

kalman_step(y, a, P, c, d, F_inv, T, Z, R, H, Q)

Need to override the base step to add an argument to self.update, passing F_inv at every step.

predict(a, P, c, T, R, Q)

Perform the prediction step of the Kalman filter.

unpack_args(args)

The order of inputs to the inner scan function is not known, since some, all, or none of the input matrices can be time varying.

update(a, P, c, d, F_inv, y, Z, H, all_nan_flag)

Perform the update step of the Kalman filter.