Page 1 of 1

ABCs

PostPosted: Fri Sep 03, 2010 8:38 am
by rafo
Hi,

I need some help about the model from McCandless ABCs of RBCs open economy model with money. Somebody tried it before who can help me? My mod file is here:


var Y H A K e P C r r_f M B X P_f w g;
varexo epsilon1 epsilon2 epsilon3;

parameters theta delta beta kapa r_poc rho1 rho2 rho3 sigma a;
theta=0.36;
delta=0.15;
beta=0.99;
kapa=4;
r_poc=0.03;
rho1=0.9;
rho2=0.9;
rho3=0.8;
sigma = 0.01;
a=0.01;


model;
%C+K-(1-delta)*K(-1)+X=Y;
Y=A*(K(-1)^theta)*H^(1-theta);
e/(P(+1)*C(+1))=beta*((e(+1)*(1+r_f))/(P(+2)*C(+2)));
(P/(P(+1)*C(+1)))*(1+kapa*(K-K(-1)))=beta*((P(+1))/(P(+2)*C(+2)))*(r(+1)+(1-delta)+kapa*(K(+1)-K));
B/w+beta*(P/(P(+1)*C(+1)))=0;
P*C=M;
M/P+((e*B)/P)+K+(kapa/2)*(K-K(-1))^2=w*H+r*K(-1)+(1-delta)*K(-1)+((e*(1+r_f(-1))*B(-1))/P);
w=(1-theta)*A*((K(-1))^theta)*(H^(-theta));
r=theta*A*((K(-1))^(theta-1))*(H^(1-theta));
B=(1+r_f(-1))*B(-1)+P_f*X;
r_f=r_poc-a*(B/P_f);
e=P/P_f;
M=g*M(-1);
A=rho1*A(-1)+epsilon1;
P_f=1-rho2+rho2*(P_f(-1))+epsilon2;
g=rho3*(g(-1))+epsilon3;


end;
resid(i);
steady;
check;

shocks;
var epsilon1; stderr 0.01;
var epsilon2; stderr 0.01;
var epsilon3; stderr 0.01;
end;

stoch_simul;



And I tried to get some results, with different initial values, but every time I got the folowing message:


Starting Dynare (version 4.1.2).
Starting preprocessing of the model file ...
Substitution of endo leads >= 2: added 2 auxiliary variables and equations.
Found 17 equation(s).
Evaluating expressions...done
Computing static model derivatives:
- order 1
Computing dynamic model derivatives:
- order 1
- order 2
Processing outputs ...done
Preprocessing completed.
Starting MATLAB/Octave computing.

Warning: Divide by zero. This
warning will be removed in a future
release.
Consider using DBSTOP IF
NANINF when debugging.
> In open_nista_static at 21
In resid at 62
In open_nista at 150
In dynare at 132
Warning: Divide by zero. This
warning will be removed in a future
release.
Consider using DBSTOP IF
NANINF when debugging.
> In open_nista_static at 24
In resid at 62
In open_nista at 150
In dynare at 132
Warning: Divide by zero. This
warning will be removed in a future
release.
.....
STEADY: numerical initial values incompatible with the following equations
Columns 1 through 5

2 3 4 6 7

Columns 6 through 10

8 10 11 16 17

??? Error using ==> dynare_solve at
82
exiting ...

Error in ==> steady_ at 124
[oo_.steady_state,check] =
dynare_solve([M_.fname
'_static'],...

Error in ==> steady at 52
steady_;

Error in ==> open_nista at 151
steady;

Error in ==> dynare at 132
evalin('base',fname) ;


So i think that that there is something wrong with my model but I don't know what because I wrote down the equation from the book. Maybe the initial values or somethink else?
Maybe somebody could help me?

Than you.

Re: ABCs

PostPosted: Fri Sep 03, 2010 11:28 am
by jpfeifer
Your problem is that you did not specify intial values for the steady state in the initval statement. Hence, Dynare takes them as 0. The right hand side of equation 2 for example e/(P(+1)*C(+1)) is then 0/0. This division by 0 gives you the error message
STEADY: numerical initial values incompatible with the following equations
Columns 1 through 5

2 3 4 6 7

Columns 6 through 10

8 10 11 16 17

Re: ABCs

PostPosted: Sat Sep 04, 2010 3:04 pm
by rafo
Thank you for your answer.
But when I try for example the attached .mod file (from the same book, just the more trivial example for the open economy) with the initial values from the book, MATLAB gives the folowing mesage:

??? Error using ==> steady_ at 132
STEADY: convergence problems

Error in ==> steady at 52
steady_;

Error in ==> open_beze at 141
steady;

Error in ==> dynare at 132
evalin('base',fname) ;

somebody tired it?somebody could help me?

best,

Rafo

Re: ABCs

PostPosted: Sun Sep 05, 2010 7:16 am
by jpfeifer
Your process for A is wrong as its steady state is 0. You should enter it as
Code: Select all
log(A(+1))=rho*log(A)+eps;
to make it mean 1. Also, put
Code: Select all
resid(1);

before the steady command to see the residuals of the equations with your starting values. Some of them are far off.

Re: ABCs

PostPosted: Mon Sep 06, 2010 8:30 am
by rafo
Thank you for your help.

Re: ABCs

PostPosted: Mon Sep 06, 2010 8:34 am
by rafo
But I have one more question about the interpretation of the output(momments, corelations, autocorrelations). Are this results given in levels or in the log-defference of the steady state or something else?

Best,

Rafael

Re: ABCs

PostPosted: Fri Sep 10, 2010 9:16 am
by StephaneAdjemian
Hi, first order moments are in levels and second order moments are in deviations to the mean (by definition of the covariance function) which with a first order approximation is the deterministic steady state of the model.

Best, Stéphane.