| 1 |
@#define extended_path_version = 1 |
| 2 |
|
| 3 |
var Capital, Output, Labour, Consumption, Investment, Output1, Labour1, Consumption1, Output2, Labour2, Consumption2, Efficiency, efficiency, ExpectedTerm, LagrangeMultiplier; |
| 4 |
|
| 5 |
varexo EfficiencyInnovation; |
| 6 |
|
| 7 |
parameters beta, theta, tau, alpha, psi, delta, rho, effstar, sigma; |
| 8 |
|
| 9 |
@#include "rbcii-calibration.inc" |
| 10 |
|
| 11 |
model(use_dll); |
| 12 |
|
| 13 |
efficiency = rho*efficiency(-1) + sigma*EfficiencyInnovation; |
| 14 |
|
| 15 |
Efficiency = effstar*exp(efficiency); |
| 16 |
|
| 17 |
(((Consumption1^theta)*((1-Labour1)^(1-theta)))^(1-tau))/Consumption1 - beta*ExpectedTerm(1) + LagrangeMultiplier(1)*beta*(1-delta); |
| 18 |
|
| 19 |
ExpectedTerm = ((((Consumption^theta)*((1-Labour)^(1-theta)))^(1-tau))/Consumption)*(alpha*((Output/Capital(-1))^(1-psi))+1-delta); |
| 20 |
|
| 21 |
LagrangeMultiplier = max(0, (((Consumption^theta)*((1-Labour)^(1-theta)))^(1-tau))/Consumption - beta*ExpectedTerm(1) + LagrangeMultiplier(1)*beta*(1-delta)); |
| 22 |
|
| 23 |
((1-theta)/theta)*(Consumption1/(1-Labour1)) - (1-alpha)*(Output1/Labour1)^(1-psi); |
| 24 |
|
| 25 |
Output1 = Efficiency*(alpha*(Capital(-1)^psi)+(1-alpha)*(Labour1^psi))^(1/psi); |
| 26 |
|
| 27 |
Consumption2 = Output2; |
| 28 |
|
| 29 |
((1-theta)/theta)*(Consumption2/(1-Labour2)) - (1-alpha)*(Output2/Labour2)^(1-psi); |
| 30 |
|
| 31 |
Output2 = Efficiency*(alpha*(Capital(-1)^psi)+(1-alpha)*(Labour2^psi))^(1/psi); |
| 32 |
|
| 33 |
Consumption = (Output1 > Consumption1)*Consumption1 + (1-(Output1 > Consumption1))*Consumption2; |
| 34 |
|
| 35 |
Labour = (Output1 > Consumption1)*Labour1 + (1-(Output1 > Consumption1))*Labour2; |
| 36 |
|
| 37 |
Output = (Output1 > Consumption1)*Output1 + (1-(Output1 > Consumption1))*Output2; |
| 38 |
|
| 39 |
Capital = Output-Consumption + (1-delta)*Capital(-1); |
| 40 |
|
| 41 |
Investment = Capital - (1-delta)*Capital(-1); |
| 42 |
|
| 43 |
end; |
| 44 |
|
| 45 |
@#if extended_path_version |
| 46 |
|
| 47 |
shocks; |
| 48 |
var EfficiencyInnovation = 1; |
| 49 |
end; |
| 50 |
|
| 51 |
steady(nocheck); |
| 52 |
|
| 53 |
//options_.ep.stochastic.order = 0; |
| 54 |
set_dynare_seed(2009); |
| 55 |
[Simulated_time_series, oo_ ]= extended_path([], 200, [], options_, M_, oo_); |
| 56 |
Simulated_time_series.save('rbcii-sim-data'); |
| 57 |
if ~oo_.extended_path.status |
| 58 |
error('Extended path did not find solution in rbcii.mod') |
| 59 |
end |
| 60 |
@#else |
| 61 |
|
| 62 |
shocks; |
| 63 |
var EfficiencyInnovation; |
| 64 |
periods 1; |
| 65 |
values -.8; |
| 66 |
end; |
| 67 |
|
| 68 |
steady;//(nocheck); |
| 69 |
|
| 70 |
options_.simul.maxit = 100; |
| 71 |
|
| 72 |
perfect_foresight_setup(periods=4000); |
| 73 |
perfect_foresight_solver; |
| 74 |
|
| 75 |
n = 100; |
| 76 |
|
| 77 |
figure('Name','(rbcii) Investment.'); |
| 78 |
plot(Output(1:n)-Consumption(1:n),'-b','linewidth',2) |
| 79 |
|
| 80 |
@#endif |