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

3
var Capital, Output, Labour, Consumption,  Investment, Output1, Labour1, Consumption1, Output2, Labour2, Consumption2, Efficiency, efficiency, ExpectedTerm;
4
5
6

varexo EfficiencyInnovation;

7
parameters beta, theta, tau, alpha, psi, delta, rho, effstar, sigma;
8
9
10
11
12
13
14
15
16
17

/*
** Calibration
*/


beta    =  0.990;
theta   =  0.357;
tau     =  2.000;
alpha   =  0.450;
18
psi     = -0.500;
19
20
21
delta   =  0.020;
rho     =  0.995;
effstar =  1.000;
22
sigma   =  0.100;
23
24
25
26
27


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

29
model(use_dll);
30

31
  efficiency = rho*efficiency(-1) + sigma*EfficiencyInnovation;
32

33
  Efficiency = effstar*exp(efficiency-.5*sigma*sigma/(1-rho*rho));
34

35
  (((Consumption1^theta)*((1-Labour1)^(1-theta)))^(1-tau))/Consumption1 - ExpectedTerm(1);
36

37
  ExpectedTerm = beta*((((Consumption^theta)*((1-Labour)^(1-theta)))^(1-tau))/Consumption)*(alpha*((Output/Capital(-1))^(1-psi))+1-delta);
38

39
  ((1-theta)/theta)*(Consumption1/(1-Labour1)) - (1-alpha)*(Output1/Labour1)^(1-psi);
40

41
  Output1 = Efficiency*(alpha*(Capital(-1)^psi)+(1-alpha)*(Labour1^psi))^(1/psi);
42

43
44
45
46
47
48
49
50
51
  Consumption2  = Output2;

  ((1-theta)/theta)*(Consumption2/(1-Labour2)) - (1-alpha)*(Output2/Labour2)^(1-psi);

  Output2 = Efficiency*(alpha*(Capital(-1)^psi)+(1-alpha)*(Labour2^psi))^(1/psi);

  Consumption = (Output1 > Consumption1)*Consumption1 + (1-(Output1 > Consumption1))*Consumption2;

  Labour = (Output1 > Consumption1)*Labour1 + (1-(Output1 > Consumption1))*Labour2;
52

53
54
55
56
57
  Output = (Output1 > Consumption1)*Output1 + (1-(Output1 > Consumption1))*Output2;

  Capital = Output-Consumption + (1-delta)*Capital(-1);

  Investment = Capital - (1-delta)*Capital(-1);
58
59
60

end;

61
62
63
// Write analytical steady state file (without globals)
options_.steadystate_flag = 2;
copyfile('rbcii_steady_state.m','rbcii_steadystate2.m');
64
65
66
67

@#if extended_path_version

    shocks;
68
    var EfficiencyInnovation = 1;
69
70
    end;

71
    steady(nocheck);
72

73
74
    options_.maxit_ = 100;
    options_.ep.verbosity = 0;
75
    options_.ep.stochastic.order = 0;
76
    options_.ep.stochastic.nodes = 2;
77
    options_.console_mode = 0;
78

79
    ts = extended_path([],100);
80

81
    options_.ep.stochastic.order = 1;
82
83
84
85
    profile on
    ts1_4 = extended_path([],100);
    profile off
    profile viewer
86
87
88
89
90
@#else

    shocks;
    var EfficiencyInnovation;
    periods 1;
91
    values -.8;
92
93
    end;

94
    steady;//(nocheck);
95

96
    options_.maxit_ = 100;
97

98
99
100
    simul(periods=4000);

    n = 100;
101
102

    figure('Name','(rbcii) Investment.');
103
    plot(Output(1:n)-Consumption(1:n),'-b','linewidth',2)
104

105
@#endif