Skip to content

Instantly share code, notes, and snippets.

@stepan-a
Created October 14, 2013 11:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stepan-a/6974512 to your computer and use it in GitHub Desktop.
Save stepan-a/6974512 to your computer and use it in GitHub Desktop.
Perfect foresight simulation: The RBC model.
var Consumption, Capital, Output, LoggedProductivity;
varexo LoggedProductivityInnovation ;
parameters beta, alpha, delta, rho ;
beta = .99;
alpha = .33;
delta = .02;
rho = .98;
model;
LoggedProductivity = rho*LoggedProductivity(-1) + LoggedProductivityInnovation ;
Consumption(1)/Consumption = beta*(alpha*exp(LoggedProductivity(1))*Capital^(alpha-1)+1-delta) ;
Consumption + Capital = Output + (1-delta)*Capital(-1) ;
Output = exp(LoggedProductivity)*Capital(-1)^alpha ;
end;
steady_state_model;
b = 1/beta-1;
Capital = (alpha/(b+delta))^(1/(1-alpha));
Output = (alpha/(b+delta))^(alpha/(1-alpha));
Consumption = (alpha/(b+delta))^(alpha/(1-alpha)) - delta*(alpha/(b+delta))^(1/(1-alpha));
LoggedProductivity = 0;
end;
steady;
shocks;
var LoggedProductivityInnovation;
periods 1 2 3 4 5 6 7 8 9 10;
values .5 -.4 .3 -.2 .1 -.09 .08 -.07 .06 -.05 ;
end;
simul(periods=400,maxit=10);
figure('Name','LoggedProductivity')
plot(LoggedProductivity(1:100))
figure('Name','Consumption')
plot(Consumption(1:100))
figure('Name','Output')
plot(Output(1:100))
figure('Name','Capital')
plot(Capital(1:100))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment