Page 1 of 1

Help with code

PostPosted: Thu May 02, 2013 2:02 pm
by Phacks
Good Day,

Ive been working with this code, but I cannot find why is still sending me a syntaxis error!.. please your support thank you!..

/* Y shows output, c consumption, k capital, i investment, l is labor, h working hour, psi shows B/Z = 2,67/0,74 = 0,277 */


/* VARIABLES*/
var Y, L, C, I, W, K, ly, lh, lc, li, lw, lk z ;
varexo e;

parameters beta, fi, alpha, delta, psi, ze;

alpha = 0.36;
beta = 0.99;
delta = 0.024;
rho = 0.95;
sigma = 0.09;
psi = 0.277;
ze = 1;

/* Steady states*/

rr=1/beta-1;
zss = 1;
css=(1-alpha)*(zss/psi)*(alpha*zss/(rr+delta))^(alpha/(1-alpha));
kss=css/((rr+delta)/alpha-delta);
yss=ze*(kss^(alpha))*(L^(1-alpha));
iss=delta*kss;

wss=(1-alpha)*yss/L;

/* MODEL*/

model;

(1/beta)*C(+1)/C=alpha*Y(+1)/K+1-delta; /* Euler equation*/
psi*C=(1-alpha)*Y/L; /*labor market eq.*/
Y = C + K - (1-delta)*K(-1); /*Resource constraint*/
Y = exp(z)*K(-1)^alpha*L^(1-alpha); /* production function*/
I=Y-C;
W=(1-alpha)*Y/L; /* real wages*/
z=fi*z(-1)+e; /*theta-shock follows this process -law of motion*/

/*log transformations of end. variables*/
ly=log(Y);
lh=log(L);
lc=log(C);
li=log(I);
lw=log(W);
lk=log(K);
end;



/*i found some initial values from other examples in dynare, but i am not sure if they fits on with theory or not*/
initval;
Y = 1.08068253095672;
C = 0.80359242014163;
L = 0.29175631001732;
K = 11.08360443260358;
I = 1.2;
W = 2.07;
e = 0;
end;

shocks;
var e;
stderr 0.009;
end;

Re: Help with code

PostPosted: Fri May 03, 2013 3:30 pm
by kyri82
Hi,

I made some corrections but you still have some mistakes. Btw I don't see why you try to get steady-state constants and then ask Dynare to calculate the steady-state for you.

Have a look at it. Hope it helps.

Kyriacos

Re: Help with code

PostPosted: Mon May 06, 2013 5:03 pm
by Phacks
Hi!,

Thank you for the comment. Im still working with this code, Ill post you back when I have all, you are right about the steady-state. Thank you for your help :)

Hugo

Re: Help with code

PostPosted: Fri May 10, 2013 9:27 am
by Phacks
Hello!,

Im sorry.. is me again.. as you can see Im very new in using dynare and still having some problems with the code. Can you please help me?. Thank you

%/* Y shows output, c consumption, k capital, i investment, l is labor, h working hour, psi shows B/Z = 2,67/0,74 = 0,277 */


%/* VARIABLES*/
var Y L C I W K ly lh lc li lw lk z ;
varexo e;

parameters beta, fi, alpha, delta, psi, ze;

alpha = 0.36;
beta = 0.99;
delta = 0.024;
rho = 0.95;
sigma = 0.09;
psi = 0.277;
ze = 1;

/* Steady states*/

rr=1/beta-1;
zss = 1;
css=(1-alpha)*(zss/psi)*(alpha*zss/(rr+delta))^(alpha/(1-alpha));
kss=css/((rr+delta)/alpha-delta);
yss=ze*(kss^(alpha))*(L^(1-alpha));
iss=delta*kss;
wss=(1-alpha)*yss/L;


/* MODEL*/

model;

(1/beta)*C(+1)/C=alpha*Y(+1)/K+1-delta; /* Euler equation*/
psi*C=(1-alpha)*Y/L; /*labor market eq.*/
Y = C + K - (1-delta)*K(-1); /*Resource constraint*/
Y = exp(z)*K(-1)^alpha*L^(1-alpha); /* production function*/
I=Y-C;
W=(1-alpha)*Y/L; /* real wages*/
z=fi*z(-1)+e; /*theta-shock follows this process -law of motion*/

/*log transformations of end. variables*/
ly=log(Y);
lh=log(L);
lc=log(C);
li=log(I);
lw=log(W);
lk=log(K);
end;

shocks;
var e;
stderr 0.009;
end;

stoch_simul;

Re: Help with code

PostPosted: Fri May 10, 2013 10:30 am
by Phacks
Sorry... I had many small errors.. here is the correct code. Thanks for your support.

%/* Y shows output, c consumption, k capital, i investment, l is labor, h working hour, psi shows B/Z = 2,67/0,74 = 0,277 */


%/* VARIABLES*/
var ly, lh, lc, li, lw, lk, z;
varexo e;

parameters alpha, beta, fi, delta, psi;

alpha = 0.36;
beta = 0.99;
delta = 0.024;
fi = 0.95;
psi = 0.277;

/* Steady states*/
rr=1/beta-1;
zss = 1;
css=(1-alpha)*(zss/psi)*(alpha*zss/(rr+delta))^(alpha/(1-alpha));
kss=css/((rr+delta)/alpha-delta);
hss=(1/psi)*(1-alpha*rr/(rr+(1-alpha)*delta));
yss=zss*kss^(alpha) * hss^(1-alpha);
iss=delta*kss;
wss=(1-alpha)*yss/hss;


/* MODEL*/

model;

(1/beta)*exp(lc(+1)-lc)=alpha*exp(ly(+1)-lk)+1-delta; /* Euler equation*/
psi*exp(lc)=(1-alpha)*exp(ly-lh); /*labor market eq.*/
exp(ly) = exp(lc) + exp(lk) - (1-delta)*exp(lk(-1)); /*Resource constraint*/
exp(ly) = exp(z+alpha*lk(-1)+(1-alpha)*lh); /* production function*/
exp(li)=exp(ly)-exp(lc);
exp(lw)=(1-alpha)*exp(ly-lh); /* real wages*/
z=fi*z(-1)+e; /*theta-shock follows this process -law of motion*/
end;

/*log transformations of end. variables*/
initval;
ly=log(yss);
lh=log(hss);
lc=log(css);
li=log(iss);
lw=log(wss);
lk=log(kss);
z=zss;
end;


shocks;
var e;
stderr 0.009;
end;
steady;
stoch_simul(order=1,irf=100) ly lh lc li lk z;

stoch_simul;