rbcii.mod 3.67 KB
Newer Older
1
@#define extended_path_version = 1
2

3
var Capital, Output, Labour, Consumption, Investment, Efficiency, efficiency, ExpectedTerm;
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

varexo EfficiencyInnovation;

parameters beta, theta, tau, alpha, psi, delta, rho, effstar, sigma2;

/*
** Calibration
*/


beta    =  0.990;
theta   =  0.357;
tau     =  2.000;
alpha   =  0.450;
psi     =  -0.500;
delta   =  0.020;
rho     =  0.995;
effstar =  1.000;
sigma2  =  0.001;


@#if extended_path_version
    rho = 0.800;
@#endif
28

29
external_function(name=mean_preserving_spread,nargs=2);
30

31
model;
32
33
34
35
36

  // Eq. n°1:
  efficiency = rho*efficiency(-1) + EfficiencyInnovation;

  // Eq. n°2:
37
  Efficiency = effstar*exp(efficiency-mean_preserving_spread(rho,sigma2));
38
39
40
41
42

  // Eq. n°3:
  Output = Efficiency*(alpha*(Capital(-1)^psi)+(1-alpha)*(Labour^psi))^(1/psi);

  // Eq. n°4:
43
  Capital = max(Output-Consumption,0) + (1-delta)*Capital(-1);
44
45
46
47
48

  // Eq. n°5:
  ((1-theta)/theta)*(Consumption/(1-Labour)) - (1-alpha)*(Output/Labour)^(1-psi);

  // Eq. n°6:
49
  ExpectedTerm = beta*((((Consumption^theta)*((1-Labour)^(1-theta)))^(1-tau))/Consumption)*(alpha*((Output/Capital(-1))^(1-psi))+1-delta);
50
51

  // Eq. n°7:
52
  Investment = Capital - (1-delta)*Capital(-1);
53

54
55
  // Eq. n°8: (Euler equation, to be skipped if investment is on its lower bound)
  (Investment>0)*((((Consumption^theta)*((1-Labour)^(1-theta)))^(1-tau))/Consumption - ExpectedTerm(1)) + (1-(Investment>0))*(Output-Consumption);
56
57
58

end;

59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
steady_state_model;
efficiency = 0;
Efficiency = effstar*exp(efficiency-mean_preserving_spread(rho,sigma2));
// Compute steady state ratios.
Output_per_unit_of_Capital=((1/beta-1+delta)/alpha)^(1/(1-psi));
Consumption_per_unit_of_Capital=Output_per_unit_of_Capital-delta;
Labour_per_unit_of_Capital=(((Output_per_unit_of_Capital/Efficiency)^psi-alpha)/(1-alpha))^(1/psi);
Output_per_unit_of_Labour=Output_per_unit_of_Capital/Labour_per_unit_of_Capital;
Consumption_per_unit_of_Labour=Consumption_per_unit_of_Capital/Labour_per_unit_of_Capital;

// Compute steady state share of capital.
ShareOfCapital=alpha/(alpha+(1-alpha)*Labour_per_unit_of_Capital^psi);

/// Compute steady state of the endogenous variables.
Labour=1/(1+Consumption_per_unit_of_Labour/((1-alpha)*theta/(1-theta)*Output_per_unit_of_Labour^(1-psi)));
Consumption = Consumption_per_unit_of_Labour*Labour;
Capital = Labour/Labour_per_unit_of_Capital;
Output = Output_per_unit_of_Capital*Capital;
Investment = delta*Capital;
ExpectedTerm = beta*((((Consumption^theta)*((1-Labour)^(1-theta)))^(1-tau))/Consumption)*(alpha*((Output/Capital)^(1-psi))+1-delta);
end;
80
81
82
83
84
85
86
87

@#if extended_path_version

    shocks;
    var EfficiencyInnovation = sigma2;
    end;

    steady;
88

89
90
    options_.maxit_ = 100;
    options_.ep.verbosity = 0;
91
    options_.ep.stochastic.order = 0;
92
    options_.ep.stochastic.nodes = 2;
93
    options_.console_mode = 0;
94
    ts = extended_path([],100);
95

96
    options_.ep.stochastic.order = 1;
97
    sts = extended_path([],100);
98

99
100
101
102
103
104
    options_.ep.stochastic.order = 2;
    sts2 = extended_path([],100);

    options_.ep.stochastic.order = 3;
    sts3 = extended_path([],100);

105
    figure(1)
106
107
    plot(ts(2,:)-ts(4,:));

108
109
110
111
112
    figure(2)
    plot(sts(2,:)-sts(4,:));

    figure(3)
    plot(sts(2,:)-ts(2,:))
113

114
115
    figure(4)
    plot([(ts(2,:)-ts(4,:))' (sts(2,:)-sts(4,:))' (sts2(2,:)-sts2(4,:))' (sts3(2,:)-sts3(4,:))']) 
116
117
118
119
120
121
122
123
124
@#else

    shocks;
    var EfficiencyInnovation;
    periods 1;
    values -.4;
    end;

    steady;
125

126
    options_.maxit_ = 100;
127

128
129
130
    simul(periods=4000);

    n = 100;
131
132

    figure('Name','(rbcii) Investment.');
133
    plot(Output(1:n)-Consumption(1:n),'-b','linewidth',2)
134
135
136

    figure('Name','(rbcii) Lagrange multiplier associated to the positivity constraint on investment.');
    plot(LagrangeMultiplier(1:n),'-b','linewidth',2)
137

138
@#endif