NAME
compute_kalman_filter_2_stable - Calculates the marginal posteriors of an LDS
SYNOPSIS
#include "sequential/sequential_lds.h"
Example compile flags (system dependent):
-DLINUX_X86_64 -DLINUX_X86_64_OPTERON -DGNU_COMPILER
-I/home/kobus/include
-L/home/kobus/misc/load/linux_x86_64_opteron -L/usr/lib/x86_64-linux-gnu
-lKJB -lfftw3 -lgsl -lgslcblas -ljpeg -lSVM -lstdc++ -lpthread -lSLATEC -lg2c -lacml -lacml_mv -lblas -lg2c -lncursesw
int compute_kalman_filter_2_stable
(
Vector_vector **means,
Matrix_vector **covariances,
double *likelihood,
const Vector_vector *y,
const Matrix_vector *A,
const Matrix_vector *Q,
const Matrix_vector *H,
const Matrix_vector *R,
const Vector *mu_0,
const Matrix *S_0
);
DESCRIPTION
This routine calculates the marginal posterior distributions for a linear
dynamical system model. Here, y is the set of observations and let x be
the set of (latent) state variables. This routine computes the distributions
p(x_k | y_k, ..., y_k)
for k = 1, ..., N, where the x_k are n-vectors and the y_k are m-vectors.
Since these distributions are normal, it suffices to compute
their means and covariances, which this routine puts in *means
and *covariances. The rest of the parameters are best explained by
seeing the equations of motion of the LDS:
x_1 = mu_0 + u,
x_k = A_k * x_{k-1} + w_k
y_k = H_k * z_i + v_k
where w_k ~ N(0, Q_k) and v_k ~ N(0, R_k) and u ~ N(0, S_0), and the A_k
and Q_k are nxn matrices, the H_k is an mxn matrix and R_k is an mxm matrix.
Finally, this routine also computes the incomplete-data log-likelihood (LOG!)
of the LDS, i.e.,
log p(y_1, y_2, ..., y_N | A, H, Q, R, mu_0, S_0).
The difference between this and compute_kalman_filter_2 is that the covariance
matrices in this routine are computed using a more numerically stable method.
Specifically, it computes S_k as
S_k = (I - K_k*H_k)*S'_k*(I-K_k*H_k)^T + K_k*R_k*K_k^T,
where as compute_kalman_filter uses the more traditional
S_k = (I-K_k*H_k)S'_k.
As usual, *means and *covariances are reused if possible and created
if needed, according to the KJB allocation semantics. Any result that is
not desired can be omitted by passing NULL to the rouitne.
RETURNS
NO_ERROR on success, and ERROR on failure, with an appropriate error
message being set.
DISCLAIMER
This software is not adequatedly tested. It is recomended that
results are checked independantly where appropriate.
AUTHOR
Ernesto Brau
DOCUMENTER
Ernesto Brau
SEE ALSO
sample_from_LDS
,
sample_from_LDS_2
,
compute_kalman_filter
,
compute_kalman_filter_stable
,
compute_kalman_filter_2