How does dynare order the state vector in estimation?

Hello again,

As you know, estimation of DSGE models requires the user to find a state-space representation of the form

y_t = Z s_t +d_t + \varepsilon_t \\s_t = c_t + T s_{t-1} + R \eta_t

I’ve managed to capture the transition matrix T from the dynare estimation routine. My question concerns: what isthe order of variables in the vector s_t? It doesn’t appear to be decided alphabetically, nor is it determined by the order of variables declared in the .mod file. Finally, I noticed the first few columns of T are zeroed out.

Where exactly did you take the T from? Dynare uses an augmented state vector in estimation. And for what purpose do you need it?

See also DSGE_mod/ABCD_test.m at master · JohannesPfeifer/DSGE_mod · GitHub

I found T by going into the dsge_likelihood.m file and writing a command to save the T matrix to a .mat file.

I am doing this particular step because I am trying to compute the likelihood function of a smets-wouters model wherein agents use AR(1) or AR(2) constant-gain least squares learning. Computing the likelihood function requires me to replicate exactly the transition matrices in the time-varying state-space model s_t = c_t + T_t s_{t-1} + R_t \eta_t \\ y_t = Zs_t + \varepsilon_t

The entries of s_t are

M_.endo_names(oo_.dr.order_var(oo_.dr.restrict_var_list))

so they are in decision rule order. The reason for the zeros is that the state space is augmented by the observed variables, which are generally not states.