NaN in deterministic simulation
Posted: Thu Apr 16, 2009 11:23 am
Hello everyone,
I am new to dynare so please excuse my naive questions
I tried to simulate the deterministic three sector model as given in Acemoglu chapter 20 which is based on Kongsamut Rebelo and Xie (2001)
however all I get is NaN s except the initial value and the last observation (where the last observation equals to the initial value). I'd appreciate any help with this..
Thanks..
Here is the dynare message....
Starting Dynare ...
Starting preprocessing of the model file ...
18 equation(s) found
Processing derivation ...
Processing Order 1... done
Processing outputs ...
Preprocessing completed.
Starting Matlab computing ...
-----------------------------------------------------
MODEL SIMULATION :
1 - err = NaN
Time of iteration :0.058
2 - err = NaN
Time of iteration :0.01
3 - err = NaN
Time of iteration :0.009
4 - err = NaN
Time of iteration :0.009
5 - err = NaN
Time of iteration :0.01
6 - err = NaN
Time of iteration :0.01
7 - err = NaN
Time of iteration :0.01
8 - err = NaN
Time of iteration :0.009
9 - err = NaN
Time of iteration :0.009
10 - err = NaN
Time of iteration :0.012
Total time of simulation :0.152
WARNING : maximum number of iterations is reached (modify options_.maxit).
And here is the mod file....
%----------------------------------------------------------------
% 0. Housekeeping
%----------------------------------------------------------------
close all;
%----------------------------------------------------------------
% 1. Defining variables
%----------------------------------------------------------------
var c_m, k, k_m, k_s, k_a, l, l_m, l_s, l_a, y_m, y_s, y_a, p_s, p_a, a, w, c_s, c_a;
% varexo e;
parameters eta_a, eta_m, eta_s, beta, epsilon, n, g, m_bar, a_bar, s_bar, alpha;
%----------------------------------------------------------------
% 2. Calibration
%----------------------------------------------------------------
% eta_a+eta_s+eta_m=1
eta_a = 0.1;
eta_m = 0.15;
eta_s = 0.75;
beta = 0.95;
epsilon = 3;
n = 0.01;
g = 0.018;
m_bar = 1;
a_bar = 4;
s_bar = 2.5;
alpha = 0.4;
% sigma_e = 1;
%----------------------------------------------------------------
% 3. Model
%----------------------------------------------------------------
model;
c_m(+1)= c_m*(((beta*(1+(s_bar*alpha*((k(-1)-k_a-k_m)^(alpha-1))*((l_s*a)^(1-alpha))*p_s)))/(1+n))^(1/epsilon));
k(-1) = k_a + k_s + k_m ;
l = l_a + l_s + l_m ;
y_m = m_bar*((k_m)^(alpha))*((l_m*a)^(1-alpha));
y_a = a_bar*((k_a)^(alpha))*((l_a*a)^(1-alpha));
y_s = s_bar*((k_s)^(alpha))*((l_s*a)^(1-alpha));
k = y_m + k(-1) -c_m*l;
p_a = m_bar/a_bar;
p_s = m_bar/s_bar;
w = a_bar*(1-alpha)*(k_a^alpha)*((l_a*a)^(-alpha))*a*p_a;
w = s_bar*(1-alpha)*(k_s^alpha)*((l_s*a)^(-alpha))*a*p_s;
m_bar*alpha*(k_m^(alpha-1))*((l_m*a)^(1-alpha)) = a_bar*alpha*(k_a^(alpha-1))*((l_a*a)^(1-alpha))*p_a;
m_bar*alpha*(k_m^(alpha-1))*((l_m*a)^(1-alpha)) = s_bar*alpha*(k_s^(alpha-1))*((l_s*a)^(1-alpha))*p_s;
a(+1) = (1+g)*a;
l(+1) = (1+n)*l;
c_s*l = y_s;
c_a*l = y_a;
l=(k(-1)*l_m)/k_m;
end;
%----------------------------------------------------------------
% 4. Computation
%----------------------------------------------------------------
initval;
k = 1;
a = 2;
l = 1;
l_a = 0.5;
l_s = 0.1;
k_a = 0.3;
k_m = 0.6;
w=1;
end;
simul(periods = 100);
I am new to dynare so please excuse my naive questions
I tried to simulate the deterministic three sector model as given in Acemoglu chapter 20 which is based on Kongsamut Rebelo and Xie (2001)
however all I get is NaN s except the initial value and the last observation (where the last observation equals to the initial value). I'd appreciate any help with this..
Thanks..
Here is the dynare message....
Starting Dynare ...
Starting preprocessing of the model file ...
18 equation(s) found
Processing derivation ...
Processing Order 1... done
Processing outputs ...
Preprocessing completed.
Starting Matlab computing ...
-----------------------------------------------------
MODEL SIMULATION :
1 - err = NaN
Time of iteration :0.058
2 - err = NaN
Time of iteration :0.01
3 - err = NaN
Time of iteration :0.009
4 - err = NaN
Time of iteration :0.009
5 - err = NaN
Time of iteration :0.01
6 - err = NaN
Time of iteration :0.01
7 - err = NaN
Time of iteration :0.01
8 - err = NaN
Time of iteration :0.009
9 - err = NaN
Time of iteration :0.009
10 - err = NaN
Time of iteration :0.012
Total time of simulation :0.152
WARNING : maximum number of iterations is reached (modify options_.maxit).
And here is the mod file....
%----------------------------------------------------------------
% 0. Housekeeping
%----------------------------------------------------------------
close all;
%----------------------------------------------------------------
% 1. Defining variables
%----------------------------------------------------------------
var c_m, k, k_m, k_s, k_a, l, l_m, l_s, l_a, y_m, y_s, y_a, p_s, p_a, a, w, c_s, c_a;
% varexo e;
parameters eta_a, eta_m, eta_s, beta, epsilon, n, g, m_bar, a_bar, s_bar, alpha;
%----------------------------------------------------------------
% 2. Calibration
%----------------------------------------------------------------
% eta_a+eta_s+eta_m=1
eta_a = 0.1;
eta_m = 0.15;
eta_s = 0.75;
beta = 0.95;
epsilon = 3;
n = 0.01;
g = 0.018;
m_bar = 1;
a_bar = 4;
s_bar = 2.5;
alpha = 0.4;
% sigma_e = 1;
%----------------------------------------------------------------
% 3. Model
%----------------------------------------------------------------
model;
c_m(+1)= c_m*(((beta*(1+(s_bar*alpha*((k(-1)-k_a-k_m)^(alpha-1))*((l_s*a)^(1-alpha))*p_s)))/(1+n))^(1/epsilon));
k(-1) = k_a + k_s + k_m ;
l = l_a + l_s + l_m ;
y_m = m_bar*((k_m)^(alpha))*((l_m*a)^(1-alpha));
y_a = a_bar*((k_a)^(alpha))*((l_a*a)^(1-alpha));
y_s = s_bar*((k_s)^(alpha))*((l_s*a)^(1-alpha));
k = y_m + k(-1) -c_m*l;
p_a = m_bar/a_bar;
p_s = m_bar/s_bar;
w = a_bar*(1-alpha)*(k_a^alpha)*((l_a*a)^(-alpha))*a*p_a;
w = s_bar*(1-alpha)*(k_s^alpha)*((l_s*a)^(-alpha))*a*p_s;
m_bar*alpha*(k_m^(alpha-1))*((l_m*a)^(1-alpha)) = a_bar*alpha*(k_a^(alpha-1))*((l_a*a)^(1-alpha))*p_a;
m_bar*alpha*(k_m^(alpha-1))*((l_m*a)^(1-alpha)) = s_bar*alpha*(k_s^(alpha-1))*((l_s*a)^(1-alpha))*p_s;
a(+1) = (1+g)*a;
l(+1) = (1+n)*l;
c_s*l = y_s;
c_a*l = y_a;
l=(k(-1)*l_m)/k_m;
end;
%----------------------------------------------------------------
% 4. Computation
%----------------------------------------------------------------
initval;
k = 1;
a = 2;
l = 1;
l_a = 0.5;
l_s = 0.1;
k_a = 0.3;
k_m = 0.6;
w=1;
end;
simul(periods = 100);