| 1 |
var Capital, Output, Labour, Consumption, Efficiency, efficiency, ExpectedTerm; |
| 2 |
|
| 3 |
varexo EfficiencyInnovation; |
| 4 |
|
| 5 |
parameters beta, theta, tau, alpha, psi, delta, rho, effstar, sigma2; |
| 6 |
|
| 7 |
beta = 0.9900; |
| 8 |
theta = 0.3570; |
| 9 |
tau = 2.0000; |
| 10 |
alpha = 0.4500; |
| 11 |
psi = -0.1000; |
| 12 |
delta = 0.0200; |
| 13 |
rho = 0.8000; |
| 14 |
effstar = 1.0000; |
| 15 |
sigma2 = 0; |
| 16 |
|
| 17 |
model; |
| 18 |
|
| 19 |
// Eq. n°1: |
| 20 |
efficiency = rho*efficiency(-1) + EfficiencyInnovation; |
| 21 |
|
| 22 |
// Eq. n°2: |
| 23 |
Efficiency = effstar*exp(efficiency); |
| 24 |
|
| 25 |
// Eq. n°3: |
| 26 |
Output = Efficiency*(alpha*(Capital(-1)^psi)+(1-alpha)*(Labour^psi))^(1/psi); |
| 27 |
|
| 28 |
// Eq. n°4: |
| 29 |
Capital = Output-Consumption + (1-delta)*Capital(-1); |
| 30 |
|
| 31 |
// Eq. n°5: |
| 32 |
((1-theta)/theta)*(Consumption/(1-Labour)) - (1-alpha)*(Output/Labour)^(1-psi); |
| 33 |
|
| 34 |
// Eq. n°6: |
| 35 |
(((Consumption^theta)*((1-Labour)^(1-theta)))^(1-tau))/Consumption = ExpectedTerm(1); |
| 36 |
|
| 37 |
// Eq. n°7: |
| 38 |
ExpectedTerm = beta*((((Consumption^theta)*((1-Labour)^(1-theta)))^(1-tau))/Consumption)*(alpha*((Output/Capital(-1))^(1-psi))+(1-delta)); |
| 39 |
|
| 40 |
end; |
| 41 |
|
| 42 |
steady_state_model; |
| 43 |
efficiency = EfficiencyInnovation/(1-rho); |
| 44 |
Efficiency = effstar*exp(efficiency); |
| 45 |
Output_per_unit_of_Capital=((1/beta-1+delta)/alpha)^(1/(1-psi)); |
| 46 |
Consumption_per_unit_of_Capital=Output_per_unit_of_Capital-delta; |
| 47 |
Labour_per_unit_of_Capital=(((Output_per_unit_of_Capital/Efficiency)^psi-alpha)/(1-alpha))^(1/psi); |
| 48 |
Output_per_unit_of_Labour=Output_per_unit_of_Capital/Labour_per_unit_of_Capital; |
| 49 |
Consumption_per_unit_of_Labour=Consumption_per_unit_of_Capital/Labour_per_unit_of_Capital; |
| 50 |
|
| 51 |
% Compute steady state share of capital. |
| 52 |
ShareOfCapital=alpha/(alpha+(1-alpha)*Labour_per_unit_of_Capital^psi); |
| 53 |
|
| 54 |
% Compute steady state of the endogenous variables. |
| 55 |
Labour=1/(1+Consumption_per_unit_of_Labour/((1-alpha)*theta/(1-theta)*Output_per_unit_of_Labour^(1-psi))); |
| 56 |
Consumption=Consumption_per_unit_of_Labour*Labour; |
| 57 |
Capital=Labour/Labour_per_unit_of_Capital; |
| 58 |
Output=Output_per_unit_of_Capital*Capital; |
| 59 |
ExpectedTerm=beta*((((Consumption^theta)*((1-Labour)^(1-theta)))^(1-tau))/Consumption) |
| 60 |
*(alpha*((Output/Capital)^(1-psi))+1-delta); |
| 61 |
end; |
| 62 |
|
| 63 |
steady; |
| 64 |
|
| 65 |
ik = varlist_indices('Capital',M_.endo_names); |
| 66 |
CapitalSS = oo_.steady_state(ik); |
| 67 |
|
| 68 |
histval; |
| 69 |
Capital(0) = CapitalSS/2; |
| 70 |
end; |
| 71 |
|
| 72 |
|
| 73 |
perfect_foresight_setup(periods=400); |
| 74 |
perfect_foresight_solver(stack_solve_algo=0); |
| 75 |
|
| 76 |
if ~oo_.deterministic_simulation.status |
| 77 |
error('Perfect foresight simulation failed') |
| 78 |
end |
| 79 |
|
| 80 |
oo0 = oo_; |
| 81 |
|
| 82 |
perfect_foresight_setup(periods=400); |
| 83 |
perfect_foresight_solver(stack_solve_algo=1); |
| 84 |
|
| 85 |
if ~oo_.deterministic_simulation.status |
| 86 |
error('Perfect foresight simulation failed') |
| 87 |
end |
| 88 |
|
| 89 |
oo1 = oo_; |
| 90 |
|
| 91 |
maxabsdiff = max(max(abs(oo0.endo_simul-oo1.endo_simul))); |
| 92 |
|
| 93 |
if max(max(abs(oo0.endo_simul-oo1.endo_simul)))>options_.dynatol.x |
| 94 |
error('stack_solve_algo={0,1} return different paths for the endogenous variables!') |
| 95 |
else |
| 96 |
skipline() |
| 97 |
fprintf('Maximum (absolute) difference between paths is %s', num2str(maxabsdiff)) |
| 98 |
skipline() |
| 99 |
end |
| 100 |
|
| 101 |
% Also test stack_solve_algo=6, which is a synonymous for stack_solve_algo=1 |
| 102 |
|
| 103 |
perfect_foresight_setup(periods=400); |
| 104 |
perfect_foresight_solver(stack_solve_algo=6); |
| 105 |
|
| 106 |
if ~oo_.deterministic_simulation.status |
| 107 |
error('Perfect foresight simulation failed') |
| 108 |
end |
| 109 |
|
| 110 |
oo6 = oo_; |
| 111 |
|
| 112 |
maxabsdiff = max(max(abs(oo0.endo_simul-oo6.endo_simul))); |
| 113 |
|
| 114 |
if max(max(abs(oo0.endo_simul-oo6.endo_simul)))>options_.dynatol.x |
| 115 |
error('stack_solve_algo={0,6} return different paths for the endogenous variables!') |
| 116 |
else |
| 117 |
skipline() |
| 118 |
fprintf('Maximum (absolute) difference between paths is %s', num2str(maxabsdiff)) |
| 119 |
skipline() |
| 120 |
end |