# SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.stats.dlm.univariate

## Class StateEquation

• java.lang.Object
• com.numericalmethod.suanshu.stats.dlm.univariate.StateEquation

• public class StateEquation
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
StateEquation(double G, double W)
Construct a time-invariant state equation without control variables.
StateEquation(double G, double H, double W, RandomStandardNormalGenerator rnorm)
Construct a time-invariant state equation.
StateEquation(StateEquation that)
Copy constructor.
StateEquation(UnivariateRealFunction G, UnivariateRealFunction W)
Construct a state equation without control variables.
StateEquation(UnivariateRealFunction G, UnivariateRealFunction H, UnivariateRealFunction W)
Construct a state equation.
StateEquation(UnivariateRealFunction G, UnivariateRealFunction H, UnivariateRealFunction W, RandomStandardNormalGenerator rnorm)
Construct a state equation.
• ### Method Summary

All Methods
Modifier and Type Method and Description
int dimension()
Get the dimension of state xt.
double G(int t)
Get G(t), the coefficient of xt - 1.
double H(int t)
Get H(t), the variance of ut.
double W(int t)
Get W(t), the variance of wt.
double xt_mean(int t, double xt_1)
Predict the next state without control variable.
double xt_mean(int t, double xt_1, double ut)
Predict the next state.
double xt_var(int t, double var_tlag_tlag)
Get the variance of the apriori prediction for the next state.
double xt(int t, double xt_1)
Evaluate the state equation without the control variable.
double xt(int t, double xt_1, double ut)
Evaluate the state equation.
• ### Methods inherited from class java.lang.Object

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

• #### StateEquation

public StateEquation(UnivariateRealFunction G,
UnivariateRealFunction H,
UnivariateRealFunction W,
RandomStandardNormalGenerator rnorm)
Construct a state equation.
Parameters:
G - the coefficient function of xt - 1
H - the coefficient function of control variables ut
W - the variance function of wt
rnorm - a standard Gaussian random number generator (for seeding)
• #### StateEquation

public StateEquation(UnivariateRealFunction G,
UnivariateRealFunction H,
UnivariateRealFunction W)
Construct a state equation.
Parameters:
G - the coefficient function of xt - 1
H - the coefficient function of control variables ut
W - the variance function of wt
• #### StateEquation

public StateEquation(UnivariateRealFunction G,
UnivariateRealFunction W)
Construct a state equation without control variables.
Parameters:
G - the coefficient function of xt - 1
W - the variance function of wt
• #### StateEquation

public StateEquation(double G,
double H,
double W,
RandomStandardNormalGenerator rnorm)
Construct a time-invariant state equation.
Parameters:
G - the coefficient of xt - 1
H - the coefficient of control variables ut
W - the variance of wt
rnorm - a standard Gaussian random number generator
• #### StateEquation

public StateEquation(double G,
double W)
Construct a time-invariant state equation without control variables.
Parameters:
G - the coefficient of xt - 1
W - the variance of wt
• #### StateEquation

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

• #### dimension

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

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

public double H(int t)
Get H(t), the variance of ut.
Parameters:
t - time
Returns:
H(t)
• #### W

public double W(int t)
Get W(t), the variance of wt.
Parameters:
t - time
Returns:
W(t)
• #### xt_mean

public double xt_mean(int t,
double xt_1,
double ut)
Predict 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 double xt_mean(int t,
double xt_1)
Predict 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 double xt_var(int t,
double var_tlag_tlag)
Get 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 variance of the posterior update
Returns:
Var(x_{t | t - 1})
• #### xt

public double xt(int t,
double xt_1,
double ut)
Evaluate 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 double xt(int t,
double xt_1)
Evaluate 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