Page 1 of 1

error in two-sector model

PostPosted: Wed May 23, 2007 10:02 am
by jhgruber
Dear all,

I am working on a 2 sector Ramsy model, I know that it is often the case the one gets singularity in the model, I like to try to figure out if this is the problem in my case, but I get the following error message all the time:

??? Error: Missing operator, comma, or semicolon.
Error in ==> c:\dynare\matlab\dynare.m
On line 21 ==> evalin('base',fname) ;

I have the feeling that this error message comes not from a singularity. Does anybody have an idea to my problem?

bellow is my mod file

Thank's in advance

Johannes


periods = 400;
var C, Yc, Yh, H, N, K, Nc, Nd, Kc, Kd, L, Xl, r, w, Ph, Pl, Z;
varexo ep;

parameters alfa, gama, teta, mh, mc, bet, dk, dh, roh, b;

alfa = 0.4;
gama = 0.15;
teta = 0.894;
mh = 0.044;
mc = 0.32;
bet = 0.95;
dk = 0.05;
dh = 0.03;
roh = 0.95;
b = 1-mc-mh;

model;

mc/C = L;
bet*((mh/H(+1))+L(+1)*Ph(+1)*(1-dh)) = L*Ph;
bet*L(+1)*(r(+1)+(1-dk)) = L;
b/(1-N) = L*w;
C + K(+1) +Ph *H(+1) = w*N + r*K + Pl*Xl + (1-dk)*K + (1-dh)*Ph*H;
H(+1) = Yh + (1-dk)*H;

alfa*(Kc^(alfa-1))*((Z*Nc)^(1-alfa))= Ph*gama*teta*(Kd^(gama*teta-1))*((Z*Nd)^((1-gama)*teta))*(Xl^(1-teta));
(1-alfa)*(Kc^alfa)*(Z^(1-alfa))*(Nc^-alfa)= Ph*(1-gama)*teta*(Kd^(gama*teta))*(Z^((1-gama)*teta))*(Nd^((1-gama)*teta-1))*Xl^(1-teta);
Nc + Nd = N;
Kc + Kd = K;
Xl = 1;
Yc = Kc^alfa*(Z*Nc)^(1-alfa);
Yh = (Kd^(gama*teta))*((Z*Nd)^((1-gama)*teta))*(Xl^(1-teta));
Ph*gama*teta*(Yh/Kd)= r;
Ph*(1-gama)*teta*(Yh/Nd) = w;
Ph*(1-teta)*(Yh/Xl) = Pl;

Z=roh*Z(-1)*exp(ep);

end;

initval;
C = 0.5384385;
Yc = 0.67022096;
Yh = 0.0171486;
H = 1.2249047;
K = 2.7;
N = 0.275;
Nc = 0.27062340;
Nd = 0.00919934;
Kc = 2.6121432;
Kd = 0.0235045;
w = 1.2;
r = 0.3;
pl = 0.2;
L = 0.591247;
Ph = 1.04899637;
Xl =1;
Z = 1; ep = 0;

end;

shocks;
var ep = 0.001;
end;
stoch_simul;

PostPosted: Wed May 23, 2007 11:10 am
by MichelJuillard
I can't replicate the error that you are reporting. It has to do with the syntax of <filename>.m created by the parser from your <filename>.mod

Try to execute <filename>.m directly from the Matlab prompt to get a clearer error message.

On my machine, I get an error indicating that Dynare can't compute the steady state (version 3) or can't compute svd(A) because of INF in A. This has also to do with computing the steady state.

Are you sure that Kd and Kc are uniquely determined at the steady state?

How far can you go computing the steady state analyticaly?

Best

Michel

PostPosted: Wed May 23, 2007 3:11 pm
by jhgruber
Michel,

to execute my file directly from the matlab prompt does not work, I get the error message: Error: Missing operator, comma, or semicolon.

I do get the following ss values by mathematica, C = 0.542, Yc= 0.674, Nc = 0.271, Nd = 0.0031, Kc = 2.62, Kd = 0.0079, Pl = 0.00190682, Yh=0.0065, Ph = 0.932, H = 0.461, L = 0.58, w = 1.4859, r = 0.10263

so far I did not try to get the ss values analyticaly

best

johannes

PostPosted: Wed May 23, 2007 4:58 pm
by jhgruber
Dear Michel,

you are right, for this version of the model Mathematica is only finding complex numbers for the ss, the ss values I found are for an (in my opinion) equivalent model, I attached the mod file below with the ss values from mathematica, if I try to run this file I get the same error message as for the other model

best
johannes

periods = 400;
var C, Yc, Yh, H, Nc, Nd, Kc, Kd, L, W, R, Ph, Pl, Xl, Z;
varexo ep;

parameters alfa, gama, teta, mh, mc, bet, dk, dh, roh, ac, ah, b;

alfa = 0.4; gama = 0.15; teta = 0.894;
mh = 0.044; mc = 0.32; bet = 0.95; dk = 0.05; dh = 0.014;
roh = 0.95;
ac = ((1-alfa)^(alfa-1)/alfa^alfa);
ah = ((((1-gama)/gama)^(teta*(gama-1))*((1-teta)/(gama*teta))^teta)/(1-gama));
b = 1-mc-mh;

model;

mc/C = L;
bet*((mh/H(+1))+L(+1)*ph(+1)*(1-dh)) = L*ph;
b/(1-Nc-Nd) = L*W;
bet*(L(+1)*(R(+1) + (1 - dk))) = L;
C(-1) + Kc + Kd - (1-dk)*(Kd(-1) + Kc(-1)) +ph(-1)*(H -(1-dh)*H(1))= R*(Kc(-1)+Kd(-1)) + W*(Nc(-1)+Nd(-1)) + Pl(-1)*Xl(-1);

(Z^(alfa-1))*R^alfa*(W^(1-alfa))*ac = 1;
(Z^(teta*(1-gama)))*(R^(teta*gama))*(W^((1-gama)*teta))*(Pl^(1-teta))*ah = Ph;
(Z^(alfa-1))*(1-alfa)*R^alfa*(W^(-alfa))*ac*Yc = Nc;
(Z^(teta*(1-gama)))*teta*(R^(teta*gama))*(W^((1-gama)*teta-1))*(Pl^(1-teta))*ah*Yh = Nd;
(Z^(alfa-1))*alfa*R^(alfa-1)*(W^(1-alfa))*ac*Yc = Kc;
(Z^(teta*(1-gama)))*gama*teta*(R^(teta*gama-1))*(W^((1-gama)*teta))*(Pl^(1-teta))*ah*Yh = Kd;
(Z^(teta*(1-gama)))*(1-teta)*(R^(teta*gama))*(W*((1-gama)*teta))*(Pl^(-teta))*ah*Yh = Xl;
Yc = Kc^alfa*(Zc*Nc)^(1-alfa);
Yh = Kd^gama*(Zd*Nd)^(1-gama);
Z=roh*Z(-1)*exp(ep);

end;

steady;
check;

initval;

C = 0.542;
Yc= 0.674;
Nc = 0.271;
Nd = 0.0031;
Kc = 2.62;
Kd = 0.0079;
Pl = 0.00190682;
Yh = 0.0065;
Ph = 0.932;
H = 0.461;
L = 0.58;
Xl =1; W = 1.4859; R = 0.10263;
Z = 1; ep = 0;

end;

shocks;
var ep = 0.001;
end;
stoch_simul;

PostPosted: Wed May 23, 2007 5:14 pm
by MichelJuillard
to execute my file directly from the matlab prompt does not work, I get the error message: Error: Missing operator, comma, or semicolon.


that is expected, but don't you get an indication about the line number where the error occurs?

Can you send me the *.m file?

Best

Michel

PostPosted: Thu May 24, 2007 7:11 am
by jhgruber
no it does indicate on which line the error occurs,

attached the m file

thank's

johannes

PostPosted: Thu May 24, 2007 7:33 am
by MichelJuillard
You can't use a filename starting with a number ...

Best

Michel

PostPosted: Thu May 24, 2007 8:08 am
by jhgruber
ok, now I get more accurate error messages

thank's a lot
Johannes