Retrieving structural (original) matrices with Dynare


Im wondering how could I retrieve the structural (original) matrices in dynare, that is, the matrices that correspond to the original problem dynare has to solve:

[FFx(t+1) + GGx(t) + HHx(t-1) + JJy(t+1) + KKy(t) + LLz(t+1) + MM*z(t)] = 0 (Uhlig´s notation)

What I need is FF, GG, HH, JJ, KK, LL, MM. I suppose Dynare computes them before solving the model, does it? If so, how could I retrieve those?

Thanks a lot! I really need them to be able to keep working!



Dynare never computes directly these matrices.

However it is possible to reconstruct these matrices using the “*_dynamic.m” file created by Dynare (if your MOD file is “filename.mod”, then Dynare will create a file called “filename_dynamic.mod”).

This file computes the residual of the model, its jacobian (g1) and possibly its hessian (g2), given the dynamic endogenous (y), the exogenous (x) and the parameters. Note that the indices of the dynamic endogenous can be mapped to the original endogenous and leads/lags using the M_.lead_lag_incidence matrix.

The matrices that you need can be reconstructed from the jacobian g1 of the problem, using some transformations related to the M_.lead_lag_incidence matrix.


Thanks a lot!

I did it that way and it turned out just fine.

Here is the code, if someone needs it (I attached prueba.m, needed to make itwork):

//NOTE: Be sure to write the variables in the preamble as following:
//first variables that are both forward and predetermined (state variables),
//then forward variables (control variables),
//and last variables that are just predetermined (exogenous variables).

// Calculates structural matrices: GG FF MM HH (LL JJ KK are all zero to keep it simple)


[g1] = prueba(params)




prueba.m (1.6 KB)

I have a 17 equation model with 2 shock processes.

My system is in the form:

A y_t = B E_t y_t+1 + C y_t-1 + K w_t
w_t = psi w_t-1 + v_t

Dynare reduces this system to 8 equations and presumably converts it to

y_t = b E_t y_t+1 + c y_t-1 + k w_t
w_t = psi w_t-1 + v_t

where b=A^(-1)B, c=A^(-1)C, k=A^(-1) K before it solves the model.

I would like to retrieve the reduced system matrices (ie the coefficient matrics in the 8 equation reduced form) that it uses to solve the model.

Ursula if you are still following this, I’d appreciate your help or anyone else please.