# SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.stats.dlm.multivariate

## Class MultivariateStateEquation

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

• public class MultivariateStateEquation
extends Object
This is the state equation in a controlled dynamic linear model.
xt = Gt * xt-1 + Ht * ut + wt,
• ### Constructor Summary

Constructors
Constructor and Description
MultivariateStateEquation(Matrix G, Matrix W)
Constructs a time-invariant state equation without control variables.
MultivariateStateEquation(Matrix G, Matrix H, Matrix W, NormalRVG rmvnorm)
Constructs a time-invariant state equation.
MultivariateStateEquation(MultivariateStateEquation that)
Copy constructor.
MultivariateStateEquation(R1toMatrix G, R1toMatrix W)
Constructs a state equation without control variables.
MultivariateStateEquation(R1toMatrix G, R1toMatrix H, R1toMatrix W)
Constructs a state equation.
MultivariateStateEquation(R1toMatrix G, R1toMatrix H, R1toMatrix W, NormalRVG rmvnorm)
Constructs a state equation.
MultivariateStateEquation(StateEquation states)
Constructs a multivariate state equation from a univariate state equation.
• ### Method Summary

All Methods
Modifier and Type Method and Description
int dimension()
Gets the dimension of state xt.
Matrix G(int t)
Gets G(t), the coefficient matrix of xt - 1.
Matrix H(int t)
Gets H(t), the covariance matrix of ut.
Matrix W(int t)
Gets W(t), the covariance matrix of wt.
Vector xt_mean(int t, Vector xt_1)
Predicts the next state without control variable.
Vector xt_mean(int t, Vector xt_1, Vector ut)
Predicts the next state.
ImmutableMatrix xt_var(int t, Matrix var_tlag_tlag)
Gets the variance of the apriori prediction for the next state.
ImmutableVector xt(int t, Vector xt_1)
Evaluates the state equation without the control variable.
ImmutableVector xt(int t, Vector xt_1, Vector ut)
Evaluates the state equation.
• ### Methods inherited from class java.lang.Object

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

• #### MultivariateStateEquation

public MultivariateStateEquation(R1toMatrix G,
R1toMatrix H,
R1toMatrix W,
NormalRVG rmvnorm)
Constructs a state equation.
Parameters:
G - the coefficient matrix function of xt - 1
H - the coefficient matrix function of control variables ut; use null if there isn't any
W - the covariance matrix function of wt
rmvnorm - a p-dimensional standard multivariate Gaussian random vector generator (for seeding); p = the dimension of W or xt
• #### MultivariateStateEquation

public MultivariateStateEquation(R1toMatrix G,
R1toMatrix H,
R1toMatrix W)
Constructs a state equation.
Parameters:
G - the coefficient matrix function of xt - 1
H - the coefficient matrix function of control variables ut; use null if there isn't any
W - the covariance matrix function of wt
• #### MultivariateStateEquation

public MultivariateStateEquation(R1toMatrix G,
R1toMatrix W)
Constructs a state equation without control variables.
Parameters:
G - the coefficient matrix function of xt - 1
W - the covariance matrix function of wt
• #### MultivariateStateEquation

public MultivariateStateEquation(Matrix G,
Matrix H,
Matrix W,
NormalRVG rmvnorm)
Constructs a time-invariant state equation.
Parameters:
G - the coefficient matrix function of xt - 1
H - the coefficient matrix function of control variables ut; use null if there isn't any
W - the covariance matrix function of wt
rmvnorm - a p-dimensional standard multivariate Gaussian random vector generator; p = the dimension of W or xt
• #### MultivariateStateEquation

public MultivariateStateEquation(Matrix G,
Matrix W)
Constructs a time-invariant state equation without control variables.
Parameters:
G - the coefficient matrix function of xt - 1
W - the covariance matrix function of wt
• #### MultivariateStateEquation

public MultivariateStateEquation(StateEquation states)
Constructs a multivariate state equation from a univariate state equation.
Parameters:
states - a univariate state equation
• #### MultivariateStateEquation

public MultivariateStateEquation(MultivariateStateEquation that)
Copy constructor.
Parameters:
that - a StateEquation
• ### Method Detail

• #### dimension

public int dimension()
Gets the dimension of state xt.
Returns:
the dimension of states
• #### G

public Matrix G(int t)
Gets G(t), the coefficient matrix of xt - 1.
Parameters:
t - time
Returns:
G(t)
• #### H

public Matrix H(int t)
Gets H(t), the covariance matrix of ut.
Parameters:
t - time
Returns:
H(t)
• #### W

public Matrix W(int t)
Gets W(t), the covariance matrix of wt.
Parameters:
t - time
Returns:
W(t)
• #### xt_mean

public Vector xt_mean(int t,
Vector xt_1,
Vector ut)
Predicts the next state.
E(x_t) = G_t * x_{t - 1} + H_t * u_t
Parameters:
t - time
xt_1 - x lag xt - 1
ut - the control variable ut
Returns:
xt
• #### xt_mean

public Vector xt_mean(int t,
Vector xt_1)
Predicts the next state without control variable.
E(x_t) = G_t * x_{t - 1} + H_t * u_t
Parameters:
t - time
xt_1 - x lag xt - 1
Returns:
xt
• #### xt_var

public ImmutableMatrix xt_var(int t,
Matrix var_tlag_tlag)
Gets the variance of the apriori prediction for the next state.
Var(x_{t | t - 1}) = G_t * Var(x_{t - 1| t - 1}) * G_t' + W_t
Parameters:
t - time
var_tlag_tlag - Var(x_{t - 1 | t - 1}), the covariance of the posterior update
Returns:
Var(x_{t | t - 1})
• #### xt

public ImmutableVector xt(int t,
Vector xt_1,
Vector ut)
Evaluates the state equation.
x_t = G_t * x_{t - 1} + H_t * u_t + w_t
Parameters:
t - time
xt_1 - x lag xt - 1
ut - the control variable ut
Returns:
xt
• #### xt

public ImmutableVector xt(int t,
Vector xt_1)
Evaluates the state equation without the control variable.
x_t = G_t * x_{t - 1} + H_t * u_t + w_t
Parameters:
t - time
xt_1 - x lag xt - 1
Returns:
xt