mixpp: bdm::KalmanCh Class Reference

bdm::KalmanCh Class Reference

Kalman filter in square root form. More...

#include <kalman.h>

Inheritance diagram for bdm::KalmanCh:

bdm::Kalman< sq_T > bdm::BM bdm::StateSpace< sq_T > bdm::root bdm::EKFCh bdm::EKFCh_chQ bdm::EKFCh_dQ List of all members.

Public Member Functions

virtual KalmanCh_copy () const
 copy constructor
void set_parameters (const mat &A0, const mat &B0, const mat &C0, const mat &D0, const chmat &Q0, const chmat &R0)
 set parameters for adapt from Kalman
void initialize ()
 initialize internal parametetrs
void bayes (const vec &yt, const vec &cond=empty_vec)
 Here dt = [yt;ut] of appropriate dimensions.
void from_setting (const Setting &set)
void validate ()

Protected Attributes

Internal storage - needs initialize()
pre array (triangular matrix)

mat preA
mat postA
 post array (triangular matrix)

Detailed Description

Kalman filter in square root form.

Trivial example:

#include "estim/kalman.h"
using namespace bdm;
// estimation of AR(0) model
int main() {
    //dimensions
    int dx = 3, dy = 3, du = 1;
    // matrices
    mat A = eye ( dx );
    mat B = zeros ( dx, du );
    mat C = eye ( dx );
    mat D = zeros ( dy, du );
    mat Q = eye ( dx );
    mat R = 0.1 * eye ( dy );
    //prior
    mat P0 = 100 * eye ( dx );
    vec mu0 = zeros ( dx );
    // Estimator
    KalmanCh KF;
    KF.set_parameters ( A, B, C, D,/*covariances*/ Q, R );
    KF.set_statistics ( mu0, P0 );
    KF.validate();
    // Estimation loop
    for ( int i = 0; i < 100; i++ ) {
        KF.bayes ( randn ( dy ), randn ( du ) );
    }
    //print results
    cout << "Posterior estimate of x is: "  << endl;
    cout << "mean: " << KF.posterior().mean() << endl;
    cout << "variance: " << KF.posterior().variance() << endl;
}

Complete constructor:


Member Function Documentation

void bdm::KalmanCh::bayes ( const vec &  yt,
const vec &  cond = empty_vec 
) [virtual]

Here dt = [yt;ut] of appropriate dimensions.

The following equality hold::

\[ \left[\begin{array}{cc} R^{0.5}\\ P_{t|t-1}^{0.5}C' & P_{t|t-1}^{0.5}CA'\\ & Q^{0.5}\end{array}\right]<\mathrm{orth.oper.}>=\left[\begin{array}{cc} R_{y}^{0.5} & KA'\\ & P_{t+1|t}^{0.5}\\ \\\end{array}\right]\]

Thus this object evaluates only predictors! Not filtering densities.

Implements bdm::BM.

Reimplemented in bdm::EKFCh_dQ, and bdm::EKFCh.

void bdm::KalmanCh::from_setting ( const Setting &  set  )  [inline, virtual]

Create object from the following structure

    class = 'KalmanCh';
    --- inherited fields ---
    bdm::Kalman<chmat>::from_setting

Reimplemented from bdm::Kalman< sq_T >.

Reimplemented in bdm::EKFCh.


The documentation for this class was generated from the following files:
Generated on 2 Dec 2013 for mixpp by  doxygen 1.4.7