Dynare to RATS Conversion Utility
Posted: Wed Feb 17, 2010 12:35 pm
We've posted a web page that converts Dynare code for DSGE models into RATS code.
To convert existing Dynare DSGE code, just go to:
http://www.estima.com/dynareconvert/dynareconvert.shtml
paste your Dynare code into the text box, and click on Submit. You'll get a new web page with the equivalent RATS code (to the extent possible), which you can copy and paste into RATS.
For more information on Dynare:
http://www.cepremap.cnrs.fr/dynare/
As an example, the following is a Dynare script:
The converted code is:
This requires just a bit of hand editing to produce usable input for RATS (deleting the compute stoch_simul(...) line). The endogenous variables from the Dynare var are listed in the same order on the DSGE instruction as the endogenous variables. The exogenous variables from the Dynare varexo generate additional equations without the identity option (here eqn9 to eqn13) and the series names are appended to the list of the endogenous variables on DSGE. The main set of equations are translated into the RATS form, replacing series(n) with series{-n}. All the arithmetic operators are the same in both. Most other lines in the Dynare script are translated into COMPUTE in RATS, which will generate some lines which need to be deleted.
To convert existing Dynare DSGE code, just go to:
http://www.estima.com/dynareconvert/dynareconvert.shtml
paste your Dynare code into the text box, and click on Submit. You'll get a new web page with the equivalent RATS code (to the extent possible), which you can copy and paste into RATS.
For more information on Dynare:
http://www.cepremap.cnrs.fr/dynare/
As an example, the following is a Dynare script:
Code: Select all
periods 1000;
var y, phi, r, q, exch, A, phistar, ystar;
varexo er, eq, eystar, ephistar, ez;
parameters beta, tau, k, alpha, rhor, rhoq, rhoystar, rhophistar, rhoz, gamma1, gamma2, gamma3;
beta=0.96;
tau=0.5;
k=0.5;
alpha=0.10;
rhor=0.5;
rhoq=0.4;
rhoystar=0.9;
rhophistar=0.8;
rhoz=0.2;
gamma1=1.5;
gamma2=0.25;
gamma3=0.25;
model(linear);
y=y(+1)-(tau+alpha*(2-alpha)*(1-tau))*(r-phi(+1))-rhoz*(A-A(-1))-alpha*(tau+alpha*(2-alpha)*(1-tau))*q(+1)+alpha*(2-alpha)*((1-tau)/tau)*(ystar);
phi=beta*phi(+1)+alpha*beta*q(+1)-(alpha*q)+(k/(tau+alpha*(2-alpha)*(1-tau)))*(y+alpha*(2-alpha)*((1-tau)/tau)*ystar);
r=rhor*r(-1)+(1-rhor)*(gamma1*phi+gamma2*y+gamma3*exch)+er;
exch=phi-(1-alpha)*q-phistar;
q=rhoq*q(-1)+eq;
A=A(-1)+ez;
phistar=rhophistar*phistar(-1)+ephistar;
ystar=rhoystar*ystar(-1)+eystar;
end;
shocks;
var er; stderr 0.01;
var eq; stderr 0.01;
var ez; stderr 0.01;
var eystar; stderr 0.01;
var ephistar; stderr 0.01;
end;
stoch_simul(drop=200);Code: Select all
dec series y phi r q exch A phistar ystar
dec series er eq eystar ephistar ez
dec real beta tau k alpha rhor rhoq rhoystar rhophistar rhoz gamma1 gamma2 $
gamma3
compute beta=0.96
compute tau=0.5
compute k=0.5
compute alpha=0.10
compute rhor=0.5
compute rhoq=0.4
compute rhoystar=0.9
compute rhophistar=0.8
compute rhoz=0.2
compute gamma1=1.5
compute gamma2=0.25
compute gamma3=0.25
frml(identity) eqn1 = y - (y{-1}-(tau+alpha*(2-alpha)*(1-tau))*(r-phi{-1})-rhoz*(A-A{1}) $
-alpha*(tau+alpha*(2-alpha)*(1-tau))*q{-1}+alpha*(2-alpha)*((1-tau)/tau)*(ystar))
frml(identity) eqn2 = phi - (beta*phi{-1}+alpha*beta*q{-1}-(alpha*q)+(k/(tau+alpha*(2-alpha)*(1-tau)) $
)*(y+alpha*(2-alpha)*((1-tau)/tau)*ystar))
frml(identity) eqn3 = r - (rhor*r{1}+(1-rhor)*(gamma1*phi+gamma2*y+gamma3*exch)+er)
frml(identity) eqn4 = exch - (phi-(1-alpha)*q-phistar)
frml(identity) eqn5 = q - (rhoq*q{1}+eq)
frml(identity) eqn6 = A - (A{1}+ez)
frml(identity) eqn7 = phistar - (rhophistar*phistar{1}+ephistar)
frml(identity) eqn8 = ystar - (rhoystar*ystar{1}+eystar)
compute stoch_simul(drop=200)
frml eqn9 = er
frml eqn10 = eq
frml eqn11 = eystar
frml eqn12 = ephistar
frml eqn13 = ez
group dsge eqn1 eqn2 eqn3 eqn4 eqn5 eqn6 eqn7 eqn8 eqn9 eqn10 eqn11 eqn12 eqn13
dsge(model=dsge,a=adlm,f=fdlm,z=zdlm) y phi r q exch A phistar ystar er eq eystar ephistar $
ez