I'm trying apply Mathematica's state space functions to some of the common econometrics tasks. However I seem to be stuck at the very basics.
Let me provide an example problem which I will borrow from (Zivot et. al, 2003):
Harvey (1985) and Clark (1987) provide an alternative to the BN decomposition of an I(1) time series with drift into permanent and transitory components based on unobserved components structural time series models. For example, Clark's model for the natural logarithm of postwar real GDP specifies the trend as a pure random walk, and the cycle as a stationary AR(2) process:
y=tau+c
tau=mu+tau[t-1]+v
c=phi1 c[t-1]+phi2 c[t-2]+w
v, w - normally distributed noise.
I try to setup the state space in the following way:
eq = {
(*transition*)
\[Tau][t] == \[Mu] + SystemsModelDelay[1] \[Tau][t - 1],
c[t] == \[Phi]1 SystemsModelDelay[1] c[t - 1] + \[Phi]2 SystemsModelDelay[2] c[t - 2],
(*measurement*)
y[t] == \[Tau][t] + c[t]
}
ssm = StateSpaceModel[eq,
{{c[t], 0}, {\[Tau][t], 0}},
{},
{y[t]}, t]
However mma would not return a state space.
It will work if I add {y,0} to the list of state variables which is not correct as y should be an output:
eq = {
(*transition*)
\[Tau][t] == \[Mu] + SystemsModelDelay[1] \[Tau][t - 1],
c[t] == \[Phi]1 SystemsModelDelay[1] c[t - 1] + \[Phi]2 SystemsModelDelay[2] c[t - 2],
(*measurement*)
y[t] == \[Tau][t] + c[t]
}
ssm = StateSpaceModel[eq,
{{c[t], 0}, {\[Tau][t], 0},{y[t], 0}},
{},
{y[t]}, t]
How do I translate the set of equations above into Mathematica's state space representation?
1. Zivot, E., Wang, J., Koopman, S.J. (2004) State Space Modeling in Macroeconomics and Finance Using SsfPack for S+FinMetrics