Retrieving structural (original) matrices with Dynare

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

Retrieving structural (original) matrices with Dynare

Postby ursula » Mon Oct 05, 2009 10:08 pm

Hi!

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:

[FF*x(t+1) + GG*x(t) + HH*x(t-1) + JJ*y(t+1) + KK*y(t) + LL*z(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!
Regards,


Ursula.
ursula
 
Posts: 2
Joined: Mon Oct 05, 2009 9:48 pm

Re: Retrieving structural (original) matrices with Dynare

Postby SébastienVillemot » Tue Oct 06, 2009 8:35 am

Hi,

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.

Best,
Sébastien Villemot
Economist at OFCE – Sciences Po
SébastienVillemot
 
Posts: 706
Joined: Fri Dec 07, 2007 2:29 pm
Location: Paris, France

Re: Retrieving structural (original) matrices with Dynare

Postby ursula » Tue Oct 06, 2009 6:47 pm

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)

params=M_.params;

[g1] = prueba(params)

M_orden=M_.lead_lag_incidence;
M_orden(M_orden==0)=size(g1,2)+1;

g1(:,24)=0;

FF=zeros((oo_.dr.nboth+oo_.dr.nfwrd),(oo_.dr.nboth+oo_.dr.nfwrd));
GG=zeros((oo_.dr.nboth+oo_.dr.nfwrd),(oo_.dr.nboth+oo_.dr.nfwrd));
HH=zeros((oo_.dr.nboth+oo_.dr.nfwrd),(oo_.dr.nboth+oo_.dr.nfwrd));
MM=zeros(M_.exo_nbr,M_.exo_nbr);

FF=g1(1:(oo_.dr.nboth+oo_.dr.nfwrd),M_orden(3,1:(oo_.dr.nboth+oo_.dr.nfwrd)));
GG=g1(1:(oo_.dr.nboth+oo_.dr.nfwrd),M_orden(2,1:(oo_.dr.nboth+oo_.dr.nfwrd)));
HH=g1(1:(oo_.dr.nboth+oo_.dr.nfwrd),M_orden(1,1:(oo_.dr.nboth+oo_.dr.nfwrd)));
MM=g1(1:(oo_.dr.nboth+oo_.dr.nfwrd),M_orden(2,(oo_.dr.nboth+oo_.dr.nfwrd)+1:size(g1,1)));
Attachments
prueba.m
(1.6 KiB) Downloaded 125 times
ursula
 
Posts: 2
Joined: Mon Oct 05, 2009 9:48 pm

Re: Retrieving structural (original) matrices with Dynare

Postby Paul » Sun Apr 01, 2012 9:17 am

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.
Paul
 
Posts: 1
Joined: Sun Apr 01, 2012 9:03 am


Return to Dynare help

Who is online

Users browsing this forum: No registered users and 11 guests