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

3
var Capital, Output, Labour, Consumption, Efficiency, efficiency, ExpectedTerm, LM, LagrangeMultiplier;
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
external_function(name=mean_preserving_spread);

model(block,bytecode,cutoff=0);

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

  // Eq. n°2:
  Efficiency = effstar*exp(efficiency-mean_preserving_spread(rho));

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

  // Eq. n°4:
  Capital = max(Output-Consumption + (1-delta)*Capital(-1),(1-delta)*Capital(-1));

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

  // Eq. n°6:
  (((Consumption^theta)*((1-Labour)^(1-theta)))^(1-tau))/Consumption - LagrangeMultiplier  - ExpectedTerm(1);

  // Eq. n°7:
52
  (Capital==(1-delta)*Capital(-1))*(Output-Consumption) + (1-(Capital==(1-delta)*Capital(-1)))*LM = 0;
53

54
  // Eq. n°8:
55
  (LM<0)*(LM+LagrangeMultiplier) + (1-(LM<0))*(LM-LagrangeMultiplier) = 0;
56

57
  // Eq. n°9:
58
59
60
61
62
63
64
65
66
67
68
69
  ExpectedTerm = beta*(((((Consumption^theta)*((1-Labour)^(1-theta)))^(1-tau))/Consumption)*(alpha*((Output/Capital(-1))^(1-psi))+(1-delta))-(1-delta)*LagrangeMultiplier);

end;


@#if extended_path_version

    shocks;
    var EfficiencyInnovation = sigma2;
    end;

    steady;
70

71
72
    options_.maxit_ = 100;
    options_.ep.verbosity = 0;
73
    options_.ep.stochastic.status = 0;
74
75
    options_.console_mode = 0;

76
    ts = extended_path([],1000);
77

78
    options_.ep.stochastic.status = 1;
79
    sts = extended_path([],1000);
80

81
    figure(1)
82
83
    plot(ts(2,:)-ts(4,:));

84
85
86
87
88
    figure(2)
    plot(sts(2,:)-sts(4,:));

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

90
91
92
93
94
95
96
97
98
@#else

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

    steady;
99

100
    options_.maxit_ = 100;
101
    options_.stack_solve_algo = 4;
102

103
104
105
    simul(periods=4000);

    n = 100;
106
107

    figure('Name','(rbcii) Investment.');
108
    plot(Output(1:n)-Consumption(1:n),'-b','linewidth',2)
109
110
111

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

113
@#endif