| 1 |
@#define NumberOfCountries = 2 |
| 2 |
|
| 3 |
var log_kappa; |
| 4 |
@#for Country in 1:NumberOfCountries |
| 5 |
var mu@{Country}, logit_l@{Country}, k@{Country}, a@{Country}; |
| 6 |
@#endfor |
| 7 |
|
| 8 |
parameters alpha beta varrho delta theta rhoA sigmaA; |
| 9 |
|
| 10 |
alpha = 0.3; |
| 11 |
beta = 0.99; |
| 12 |
varrho = 1.5; |
| 13 |
delta = 0.025; |
| 14 |
theta = 0.9; |
| 15 |
rhoA = 0.95; |
| 16 |
sigmaA = 0.05; |
| 17 |
|
| 18 |
@#for Country in 1:NumberOfCountries |
| 19 |
varexo epsilonA@{Country}; |
| 20 |
@#endfor |
| 21 |
|
| 22 |
model; |
| 23 |
|
| 24 |
#kappa = exp( log_kappa ); |
| 25 |
|
| 26 |
#min_A = theta ^ ( 1/alpha ); |
| 27 |
#mean_a = log( 1 - min_A ); |
| 28 |
|
| 29 |
@#for Country in 1:NumberOfCountries |
| 30 |
|
| 31 |
#K@{Country} = exp( k@{Country} ); |
| 32 |
#A@{Country} = min_A + exp( a@{Country} ); |
| 33 |
#L@{Country} = 1 / ( 1 + exp( -logit_l@{Country} ) ); |
| 34 |
|
| 35 |
#C@{Country} = kappa ^ ( -1/varrho ) - theta / ( 1-alpha ) * ( A@{Country}*(1-L@{Country}) ) ^ ( 1-alpha ); |
| 36 |
#phi@{Country} = ( 1 - theta * ( A@{Country}*(1-L@{Country}) ) ^ ( -alpha ) ) * kappa; |
| 37 |
#I@{Country} = K@{Country} - ( 1-delta ) * K@{Country}(-1); |
| 38 |
|
| 39 |
@#endfor |
| 40 |
|
| 41 |
@#for Country in 1:NumberOfCountries |
| 42 |
|
| 43 |
( a@{Country} - mean_a ) = rhoA * ( a@{Country}(-1) - mean_a ) - sigmaA * epsilonA@{Country}; |
| 44 |
L@{Country} = min( K@{Country}(-1) / A@{Country}, 1 - theta ^ ( 1/alpha ) / A@{Country} ); |
| 45 |
kappa - mu@{Country} = beta * ( ( 1-delta ) * ( kappa(+1) - mu@{Country}(+1) ) + phi@{Country}(+1) ); |
| 46 |
kappa = max( beta * ( ( 1-delta ) * ( kappa(+1) - mu@{Country}(+1) ) + phi@{Country}(+1) ), ( theta / ( 1-alpha ) * ( A@{Country}*(1-L@{Country}) ) ^ ( 1-alpha ) |
| 47 |
@#for OtherCountry in 1:NumberOfCountries |
| 48 |
+ A@{OtherCountry} * L@{OtherCountry} |
| 49 |
@#if OtherCountry != Country |
| 50 |
- C@{OtherCountry} - I@{OtherCountry} |
| 51 |
@#endif |
| 52 |
@#endfor |
| 53 |
) ^ ( -varrho ) ); |
| 54 |
|
| 55 |
@#endfor |
| 56 |
|
| 57 |
0 = 0 |
| 58 |
@#for OtherCountry in 1:NumberOfCountries |
| 59 |
+ A@{OtherCountry} * L@{OtherCountry} |
| 60 |
- C@{OtherCountry} - I@{OtherCountry} |
| 61 |
@#endfor |
| 62 |
; |
| 63 |
|
| 64 |
end; |
| 65 |
|
| 66 |
steady_state_model; |
| 67 |
|
| 68 |
a = log( 1 - theta ^ ( 1/alpha ) ); |
| 69 |
mu = 0; |
| 70 |
L = 1 - ( 1/theta * ( 2 - 1/beta - delta ) ) ^ ( -1/alpha ); |
| 71 |
K = L; |
| 72 |
I = delta * K; |
| 73 |
C = ( 1 - delta ) * L; |
| 74 |
|
| 75 |
kappa_ = ( C + theta / ( 1-alpha ) * ( 1-L ) ^ ( 1-alpha ) ) ^ ( -varrho ); |
| 76 |
|
| 77 |
log_kappa = log( kappa_ ); |
| 78 |
|
| 79 |
@#for Country in 1:NumberOfCountries |
| 80 |
|
| 81 |
mu@{Country} = mu; |
| 82 |
logit_l@{Country} = log( L / ( 1 - L ) ); |
| 83 |
k@{Country} = log( K ); |
| 84 |
a@{Country} = a; |
| 85 |
|
| 86 |
@#endfor |
| 87 |
|
| 88 |
end; |
| 89 |
|
| 90 |
steady; |
| 91 |
check; |
| 92 |
|
| 93 |
shocks; |
| 94 |
|
| 95 |
var epsilonA1; periods 1; values 2; |
| 96 |
@#for Country in 2:NumberOfCountries |
| 97 |
var epsilonA@{Country}; periods 1; values 0; |
| 98 |
@#endfor |
| 99 |
|
| 100 |
end; |
| 101 |
|
| 102 |
perfect_foresight_setup(periods=400); |
| 103 |
perfect_foresight_solver(robust_lin_solve); |
| 104 |
|
| 105 |
if ~oo_.deterministic_simulation.status |
| 106 |
error('Model did not solve') |
| 107 |
else |
| 108 |
% check consistency |
| 109 |
load endo_simul endo_simul |
| 110 |
if max(max(abs(endo_simul-oo_.endo_simul))) > 1.e-12 |
| 111 |
error('Using leads/lags in #declarations does not deliver the same results as in baseline model') |
| 112 |
end |
| 113 |
end |