Debian Codegraph @

tests/lmmcp/rbcii.mod

raw
1 /* Tests the MCP solver on a RBC model with irreversible investment.
2
3 An additional (dummy) upper bound on investment has been added, to test the
4 extended syntax with both lower and upper bounds, and parameters in the
5 bound. */
6
7 var k, y, L, c, i, A, a, mu;
8 varexo epsilon;
9 parameters beta, theta, tau, alpha, psi, delta, rho, Astar, sigma;
10
11 beta = 0.990;
12 theta = 0.357;
13 tau = 2.000;
14 alpha = 0.450;
15 psi = -2.500;
16 delta = 0.020;
17 rho = 0.998;
18 Astar = 1.000;
19 sigma = 0.100;
20
21 model;
22 a = rho*a(-1) + sigma*epsilon;
23 A = Astar*exp(a);
24 (c^theta*(1-L)^(1-theta))^(1-tau)/c - mu = beta*((c(+1)^theta*(1-L(+1))^(1-theta))^(1-tau)/c(+1)*(alpha*(y(+1)/k)^(1-psi)+1-delta)-mu(+1)*(1-delta));
25 ((1-theta)/theta)*(c/(1-L)) - (1-alpha)*(y/L)^(1-psi);
26 y = A*(alpha*(k(-1)^psi)+(1-alpha)*(L^psi))^(1/psi);
27 k = y-c+(1-delta)*k(-1);
28 i = k-(1-delta)*k(-1);
29
30 mu = 0 ⟂ 1+2*alpha > i > 0;
31 end;
32
33 steady_state_model;
34 a=0;
35 mu=0;
36 A=Astar;
37
38 // Steady state ratios
39 Output_per_unit_of_Capital=((1/beta-1+delta)/alpha)^(1/(1-psi));
40 Consumption_per_unit_of_Capital=Output_per_unit_of_Capital-delta;
41 Labour_per_unit_of_Capital=(((Output_per_unit_of_Capital/A)^psi-alpha)/(1-alpha))^(1/psi);
42 Output_per_unit_of_Labour=Output_per_unit_of_Capital/Labour_per_unit_of_Capital;
43 Consumption_per_unit_of_Labour=Consumption_per_unit_of_Capital/Labour_per_unit_of_Capital;
44
45 L=1/(1+Consumption_per_unit_of_Labour/((1-alpha)*theta/(1-theta)*Output_per_unit_of_Labour^(1-psi)));
46 c=Consumption_per_unit_of_Labour*L;
47 k=L/Labour_per_unit_of_Capital;
48 y=Output_per_unit_of_Capital*k;
49 i=delta*k;
50 end;
51
52 shocks;
53 var epsilon;
54 periods 10;
55 values -1;
56 end;
57
58 steady;
59
60 perfect_foresight_setup(periods=400);
61 perfect_foresight_solver(lmmcp, maxit=200, no_homotopy);
62
63 if ~oo_.deterministic_simulation.status
64 error('Convergence not obtained')
65 end
66 send_endogenous_variables_to_workspace;
67 n = 40;
68
69 figure(2);
70 subplot(3,2,1); plot(1:n,A(1:n)); title('A');
71 subplot(3,2,2); plot(2:n,y(2:n)); title('y');
72 subplot(3,2,3); plot(2:n,L(2:n)); title('L');
73 subplot(3,2,4); plot(1:n,k(1:n)); title('k');
74 subplot(3,2,5); plot(2:n,c(2:n)); title('c');
75 subplot(3,2,6); plot(2:n, y(2:n)-c(2:n)); title('i');
76