# SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.stats.dlm.multivariate

## Class MultivariateLinearKalmanFilter

• java.lang.Object
• com.numericalmethod.suanshu.stats.dlm.multivariate.MultivariateLinearKalmanFilter

• public class MultivariateLinearKalmanFilter
extends Object
The Kalman filter, also known as linear quadratic estimation (LQE), is an algorithm which uses a series of measurements observed over time, containing noise (random variations) and other inaccuracies, and produces estimates of unknown variables that tend to be more precise than those that would be based on a single measurement alone. More formally, the Kalman filter operates recursively on streams of noisy input data to produce a statistically optimal estimate of the underlying system state.
• ### Constructor Summary

Constructors
Constructor and Description
MultivariateLinearKalmanFilter(MultivariateDLM model)
Construct a Kalman filter from a multivariate controlled dynamic linear model.
• ### Method Summary

All Methods
Modifier and Type Method and Description
int dimension()
Get the dimension of the system, i.e., the dimension of the state vector.
void filtering(MultivariateIntTimeTimeSeries Yt)
Filter the observations without control variable.
void filtering(MultivariateIntTimeTimeSeries Yt, MultivariateIntTimeTimeSeries Ut)
Filter the observations.
ImmutableVector getFittedState(int t)
Get the posterior expected state.
MultivariateSimpleTimeSeries getFittedStates()
Get the posterior expected states.
ImmutableMatrix getFittedStateVariance(int t)
Get the posterior expected state variance.
ImmutableMatrix getKalmanGain(int t)
Get the Kalman gain.
ImmutableVector getPredictedObservation(int t)
Get the prior observation prediction.
MultivariateSimpleTimeSeries getPredictedObservations()
Get the prior observation predictions.
ImmutableMatrix getPredictedObservationVariance(int t)
Get the prior observation prediction variance.
ImmutableVector getPredictedState(int t)
Get the prior expected state.
MultivariateSimpleTimeSeries getPredictedStates()
Get the prior expected states.
ImmutableMatrix getPredictedStateVariance(int t)
Get the prior expected state variance.
int size()
Get T, the number of hidden states or observations.
• ### Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
• ### Constructor Detail

• #### MultivariateLinearKalmanFilter

public MultivariateLinearKalmanFilter(MultivariateDLM model)
Construct a Kalman filter from a multivariate controlled dynamic linear model.
Parameters:
model - a multivariate controlled DLM
• ### Method Detail

• #### filtering

public void filtering(MultivariateIntTimeTimeSeries Yt,
MultivariateIntTimeTimeSeries Ut)
Filter the observations.
Parameters:
Yt - the observations
Ut - the controls
• #### filtering

public void filtering(MultivariateIntTimeTimeSeries Yt)
Filter the observations without control variable.
Parameters:
Yt - the observations
• #### dimension

public int dimension()
Get the dimension of the system, i.e., the dimension of the state vector.
Returns:
the dimension of the system
• #### size

public int size()
Get T, the number of hidden states or observations.
Returns:
T
• #### getFittedStates

public MultivariateSimpleTimeSeries getFittedStates()
Get the posterior expected states.
Returns:
the fitted states
• #### getPredictedStates

public MultivariateSimpleTimeSeries getPredictedStates()
Get the prior expected states.
Returns:
the predicted states
• #### getPredictedObservations

public MultivariateSimpleTimeSeries getPredictedObservations()
Get the prior observation predictions.
Returns:
the predicted observations
• #### getFittedState

public ImmutableVector getFittedState(int t)
Get the posterior expected state.
Parameters:
t - time, t ≥ 1
Returns:
the fitted state
• #### getFittedStateVariance

public ImmutableMatrix getFittedStateVariance(int t)
Get the posterior expected state variance.
Parameters:
t - time, t ≥ 1
Returns:
the fitted state variance
• #### getPredictedState

public ImmutableVector getPredictedState(int t)
Get the prior expected state.
Parameters:
t - time, t ≥ 1
Returns:
the predicted state
• #### getPredictedStateVariance

public ImmutableMatrix getPredictedStateVariance(int t)
Get the prior expected state variance.
Parameters:
t - time, t ≥ 1
Returns:
the predicted state variance
• #### getPredictedObservation

public ImmutableVector getPredictedObservation(int t)
Get the prior observation prediction.
Parameters:
t - time, t ≥ 1
Returns:
the predicted observation
• #### getPredictedObservationVariance

public ImmutableMatrix getPredictedObservationVariance(int t)
Get the prior observation prediction variance.
Parameters:
t - time, t ≥ 1
Returns:
the predicted observation variance
• #### getKalmanGain

public ImmutableMatrix getKalmanGain(int t)
Get the Kalman gain.
Parameters:
t - time, t ≥ 1
Returns:
the Kalman gain