# filter_kalman¶

probnum.filtsmooth.filter_kalman(observations, locations, F, L, H, R, m0, C0, prior_model='continuous')[source]

Estimate a trajectory with a Kalman filter.

A Kalman filter estimates the unknown trajectory $$X$$ from a set of observations Y. There is a continuous-discrete and a discrete-discrete version (describing whether the prior model and measurement model are continuous/discrete).

In a continuous-discrete model, the prior distribution is described by the SDE

$\text{d}X(t) = F X(t) \text{d}t + L \text{d}W(t)$

driven by Wiener process $$W$$ and subject to initial condition

$X(t_0) \sim N(m_0, C_0).$

By default, $$t_0$$ is set to the location of the first observation.

In a discrete-discrete model, the prior distribution is described by the transition

$X_{n+1} \,|\, X_n \sim N(F X_n, L)$

subject to the same initial condition.

In both cases, the measurement model is (write $$X(t_n)=X_n$$ in the continuous case)

$Y_n \,|\, X_n \sim N(H X_n, R)$

and the Kalman filter estimates $$X$$ given $$Y_n=y_n$$, $$Y=[y_1, ..., y_N]$$.

Parameters:
• observations (ArrayLike) – (shape=(N, m)) – A list of noisy observations of the hidden trajectory.

• locations (ArrayLike) – (shape=(N, )) – Time-locations of the observations.

• F (ArrayLike) – (shape=(n, n)) – State transition matrix. Either the drift matrix in an SDE model, or the transition matrix in a discrete model (depending on the value of prior_model).

• L (ArrayLike) – (shape=(n, n)) or (shape=(n, s)) – Diffusion/dispersion matrix. Either the dispersion matrix in an SDE model, or the diffusion matrix in a discrete model (depending on the value of prior_model). In a continuous model, the matrix has shape (n, s) for s-dimensional driving Wiener process. In a discrete model, the matrix has shape (n, n).

• H (ArrayLike) – (shape=(m, n)) – Transition matrix of the (discrete) observation model.

• R (ArrayLike) – (shape=(m, m)) – Covariance matrix of the observation noise.

• m0 (ArrayLike) – (shape=(n,)) – Initial mean of the prior model.

• C0 (ArrayLike) – (shape=(n, n)) – Initial covariance of the prior model.

• prior_model (str) – Either discrete (discrete) or continuous (continuous). This affects the role of F and L. Optional. Default is continuous.

Raises:

ValueError – If prior_model is neither discrete nor continuous.

Returns:

Filtering distribution as returned by the Kalman filter.

Return type:

gaussian.FilteringPosterior