Page 1 of 1

basic rbc model with temporary and permanent shocks

PostPosted: Sun Jun 28, 2015 8:45 pm
by sevgim
Hello, I am trying to write dynare codes for basic rbc model with temporary and permanent shocks. I wrote this code below but I have still not figured out what I need to do for temporary and permanent shocks. How I can add them into the model? Can anyone explain that to me, please? Best.

var y c x l k w r A;
varexo z;

parameters alpha beta delta psi rho sigma;
alpha = 0.36;
beta = 0.99;
delta = 0.019;
psi = 1.75;
rho = 0.95;
sigma = 0.007;

model;
1/c = beta * (1/c(+1) * (1+r(+1)-delta));
psi * c = w * (1-l);
w = A * (1-alpha) * k^alpha * l^(-alpha);
r = A * alpha * k^(alpha-1) * l^(1-alpha);
c + k(+1) = A * k^alpha * l^(1-alpha) + (1-delta)*k;
log(A) = rho* log(A(-1)) + z;
y = A * k ^ alpha * l ^ ( 1-alpha );
i = y - c;

steady_state_model;
r = 1 / beta - 1 + delta;
k_y = alpha / r;
x_y = delta * k_y;
c_y = 1 - i_y;
l = (1-alpha) / (psi * c_y + 1 - alpha);
k_l = k_y ^ (1/(1-alpha));
k = k_l * l;
A = 1;
y = A * k^alpha * l^(1-alpha);
w = (1-alpha) * y / l;
i = i_y * y;
c = c_y * y;
end;
shocks;
var z;
stderr sigma;
end;
stoch_simul (order = 2, irf = 40);

Re: basic rbc model with temporary and permanent shocks

PostPosted: Mon Jul 06, 2015 7:29 am
by jpfeifer
You need to set up the model in Dynare in detrended form and then recover the non-stationary movement of the underlying non-stationary variables following a permanent shock. For an example, see the AguiarGopinath2007.mod at my homepage at https://sites.google.com/site/pfeiferecon/dynare

Re: basic rbc model with temporary and permanent shocks

PostPosted: Wed Jul 22, 2015 5:26 pm
by sevgim
Thank you very much for your help. I checked the mod file that you suggested me and I wrote my code based on it but now I am getting a mistake and i could not figure out it my self. I got this error message in below. Could you please tell me how can i fix that? I also posted my codes if you like to look at it.
best,

Reference to non-existent field 'exo_nbr'.

Error in basicrbc (line 181)
if M_.exo_nbr > 0;

Error in dynare (line 180)
evalin('base',fname) ;

Re: basic rbc model with temporary and permanent shocks

PostPosted: Thu Jul 23, 2015 7:16 am
by jpfeifer
Never put a
Code: Select all
clear all
in your mod-file

Re: basic rbc model with temporary and permanent shocks

PostPosted: Mon Aug 03, 2015 10:26 am
by sevgim
Hi,
now, I am trying to build basic rbc model with separable utility function and also using permanent and temporary shocks. I am getting that mistakes in below.Could you please tell me what is the meaning of that error and how can I sort out that problem? Thanks in advance.
Residuals of the static equations:

Equation number 1 : 0
Equation number 2 : NaN
Equation number 3 : 0.0019418
Equation number 4 : -0.073565
Equation number 5 : 0
Equation number 6 : 1.0451
Equation number 7 : 0.71068
Equation number 8 : 0.0289
Equation number 9 : 0
Equation number 10 : 0
Equation number 11 : NaN
Equation number 12 : 0


Warning: Some of the parameters have no value (chi) when using steady. If these parameters are not initialized in
a steadystate file, Dynare may not be able to solve the model...
> In test_for_deep_parameters_calibration at 46
In steady at 33
In basicrbcs at 200
In dynare at 180

STEADY: The Jacobian contains Inf or NaN. The problem arises from:

STEADY: Derivative of Equation 2 with respect to Variable h (initial value of h: 1)
STEADY: Derivative of Equation 11 with respect to Variable h (initial value of h: 1)

STEADY: The problem most often occurs, because a variable with
STEADY: exponent smaller than 1 has been initialized to 0. Taking the derivative
STEADY: and evaluating it at the steady state then results in a division by 0.
Error using dynare_solve (line 60)
An element of the Jacobian is not finite or NaN

Error in evaluate_steady_state (line 66)
[ys,check] = dynare_solve([M.fname '_static'],...

Error in steady_ (line 54)
[steady_state,params,info] =
evaluate_steady_state(oo_.steady_state,M_,options_,oo_,~options_.steadystate.nocheck);
Error in steady (line 81)
[steady_state,M_.params,info] = steady_(M_,options_,oo_);

Error in basicrbcs (line 200)
steady;

Error in dynare (line 180)
evalin('base',fname) ;