# State Space Representation

Hi,
I am trying to retrieve the following state-space representation from Dynare:

s_t = As_t-1 + Bepsilon_t
x_t = C*s_t

where s_t is a mx1 vector of states and x_t is a nx1 vector of controls. A is a mxm matrix, epsilon_t is wx1 and B is mxw. C is the policy funciton and is nxm.

However, to my knowledge, Dynare combines the two equations as one:

x_t = CAs_t-1 + CBepsilon_t

My question: How can I retrieve the coefficients of A, B, and C using Dynare (up to third-order)?

Thanks so much

At first order, this is straightforward. See github.com/JohannesPfeifer/DSGE_mod/tree/master/FV_et_al_2007 and the content of the ABCD_test.m
At higher order, the state-space needs cannot be easily represented linearly (unless you use pruning). This is not yet supported.

Dear Johannes,
Thanks for your reply. Thanks for the function ABCD_test.m. However, this function simply uses the output from Dynare and reshuffles it a bit. Basically, I am trying to estimate a model with Bayesian estimation up to the third order. The estimation itself should be fine. However, I would need to be able to retrieve the state space representation from somewhere - I was thinking about Dynare. As a first step, I tried to replicate the examples (2nd order) from Schmitt-Grohe and Uribe (2004) “Solving dynamic general equilibrium models using a second-order approximation to the policy function” - basically get the same coefficients of the 2nd order approximation. However, this seems not to be possible with Dynare… Do you have any idea how this could be accomplished?
Thanks so much,
Lorenzo

As I said, it is not clear which state space representation you mean. At higher order, you have a nonlinear statespace so that you won’t get

```s_t = A*s_t-1 + B*epsilon_t x_t = C*s_t```
but rather a more general

```s_t = f(s_t-1,epsilon_t) x_t = g(s_t)```
As there is no standard form, you would need to do this yourself. The only help you can find is the unpacking of the g_* matrices conducted in
github.com/DynareTeam/dynare/blob/master/matlab/k_order_pert.m
and the simulations in
github.com/DynareTeam/dynare/blob/master/matlab/simult_.m