3
|
9654 Views
|
3 Replies
|
8 Total Likes
View groups...
Share
GROUPS:

# Convert unobserved components model equations to state space model?

Posted 10 years ago
 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+ctau=mu+tau[t-1]+vc=phi1 c[t-1]+phi2 c[t-2]+wv, w - normally distributed noise.I try to setup the state space in the following way: eq = {    (*transition*)   \[Tau][t] == \[Mu] + SystemsModelDelay \[Tau][t - 1],   c[t] == \[Phi]1 SystemsModelDelay c[t - 1] + \[Phi]2 SystemsModelDelay 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 \[Tau][t - 1],   c[t] == \[Phi]1 SystemsModelDelay c[t - 1] + \[Phi]2 SystemsModelDelay 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
3 Replies
Sort By:
Posted 10 years ago
 The output expression must be given with in the second last argument, and not with the governing equations. I think that is the mistake you are making.eq = {(*transition*)\[Tau][t] == \[Mu] +      SystemsModelDelay \[Tau][t - 1],    c[t] == \[Phi]1 SystemsModelDelay c[       t - 1] + \[Phi]2 SystemsModelDelay c[t - 2]};ssm = StateSpaceModel[  eq, {{c[t], 0}, {\[Tau][t], 0}}, {}, {\[Tau][t] + c[t]}, t]gives Edit:@Alex, I looked more closely at your question and also realized that you are probably setting up the governing equations incorrectly. It appears the following are the governing equations.eq = {(*transition*)\[Tau][t] == \[Mu] + \[Tau][t - 1],    c[t] == \[Phi]1 c[t - 1] + \[Phi]2  c[t - 2]};That is, I don't see why you inserted SystemsModelDelay into the equations. Expressions like var[t - 1], etc take care of that. Also, my background is not finance, so you know better than me why you left out the inputs {v, w} in the state-space specification.Hope this was helpful.
Posted 10 years ago
 @Sean, state space models in econometrics are almost entirely borrowed from control systems field so I'm reasonably sure that there should be a way to convert it to mathematica's state space model.Thanks for your tip, I'll try using ARProcess. However I will persue state space solution a little more as it seems preferable and more general.
Posted 10 years ago
 I'm not very familiar with the theory of control systems, so I have to admit that I stay away from StateSpaceModel. I've tried a bit, but it's been hard for me to wrap my head around how control system engineers think. That said, are you certain that the control systems definition of a state space model is the same thing as a state space in econometrics? My guess is that they're different and this is the source of the confusion. To implement this, I would implement tau and c using ARProcess. I think you can define y with ARProcess too. ARProcess should allow you to do all the symbolic calculations you would want to do with such a process.