Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to simulate a perfect foresight RBC model with a productivity level growing linearly during twenty periods from one to two (and staying permanently and this level)?
var c k;
varexo x;
parameters alph gam delt bet;
alph=0.5;
gam=0.5;
delt=0.02;
bet=0.05;
model;
c + k - x*k(-1)^alph - (1-delt)*k(-1);
c^(-gam) - (1+bet)^(-1)*(alph*x(+1)*k^(alph-1) + 1 - delt)*c(+1)^(-gam);
end;
initval;
x = 1;
k = ((delt+bet)/(x*alph))^(1/(alph-1));
c = x*k^alph-delt*k;
end;
steady;
endval;
x = 2;
k = ((delt+bet)/(x*alph))^(1/(alph-1));
c = x*k^alph-delt*k;
end;
steady;
shocks;
var x;
periods 1:20;
values (transpose(linspace(1.05,2,20)));
end;
simul(periods=400);
rplot c;
rplot k;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment