Sorry for that… Of course, this was the problem.
I get a new error indicating variable k (capital) does not appear at current period. In the equations, it appears as k and k(-1). I tried forwarding the feasibility constraint one period ahead so k(+1), decided at t, appears. But I still get the same error.
Why is this?
PERFECT_FORESIGHT_SETUP: error in model specification : the variable(s)
k don’t appear as current period variables.
This is the full code:
@#define simulation_periods=100
//Define variables:
var l, w, s, k, L, cy, co, r;
predetermined_variables k;
varexo A {A} (long_name=‘Labor augmenting technology’)
;
parameters rho, phi, alp, n, gA, gam;
rho = .5; //rho subjective discount factor (for future C)
phi = 3.05; //phi preference for leisure
alp = .5; //alpha (alp in the code) Cobb-doublas production function parameter
n = 1; //population size
gA= .99; //gA exogenous technological growth
gam =.75; //gam aspirations term
model;
wl-s=cy; //young p. budget constraint
(1+r(+1))s=co(+1); //old p. budget constraint
co(+1)/(cy-gamcy(-1))=rho(1+r(+1)); //s f.o.c. households
w/(cy-gamcy(-1))=phi/(1-l); //l f.o.c. households
(alp(k(-1)/(AL))^(alp-1))=(1+r); //K f.o.c. firms
((k(-1)/(AL))alp)+(alp(k(-1)/(AL))^(alp-1))(-k(-1)/(AL))=w; //(AL) f.o.c. firms
nl=L; //labour market clearing
//ns=k; //financial market clearing
((k(-1)^alp)(AL)^(1-alp))-k-ncy=nco;//feasibility constraint or national identity
//A=gAA(-1); //exogenous growth process
//f10=(rho*(w*l-gam*cy(-1)))/(1+rho)-s; //"definition" (9) from comparative statics section
//f11=(w+phi*(s+gam*cy(-1)))/((1+phi)*w)-l; //"definition" (10) from comparative statics section
//f12=(1+r)*s(-1)-co; //old p. budget constraint at t-1
//f13=n*s(-1)-k(-1);
end;
initval;
w = .2;
s = 1;
k = 1;
L = .33;
l = 33;
cy = .25;
co = .25;
r = 3;
A = 0.01;
end;
shock_vals_A=cumprod((1+gA)*ones(@{simulation_periods},1))
shocks;
var A;
periods 1:@{simulation_periods};
values (shock_vals_A);
end;
//endval;
//???
//end;
perfect_foresight_setup(periods=@{simulation_periods});
perfect_foresight_solver;
rplot k;
rplot cy;
rplot s;
rplot w;