| 1 |
//Version of the ramst.mod augmented with purely backward looking AR-process that should not |
| 2 |
//alter any dynamics of original |
| 3 |
|
| 4 |
// Endogenous variables: consumption and capital |
| 5 |
var c k y_backward; |
| 6 |
|
| 7 |
// Exogenous variable: technology level |
| 8 |
varexo x; |
| 9 |
|
| 10 |
// Parameters declaration and calibration |
| 11 |
parameters alph gam delt bet aa rho_1 rho_2; |
| 12 |
alph=0.5; |
| 13 |
gam=0.5; |
| 14 |
delt=0.02; |
| 15 |
bet=0.05; |
| 16 |
aa=0.5; |
| 17 |
rho_1=0.2; |
| 18 |
rho_2=0.1; |
| 19 |
|
| 20 |
// Equilibrium conditions |
| 21 |
model; |
| 22 |
c + k - aa*x*k(-1)^alph - (1-delt)*k(-1); // Resource constraint |
| 23 |
c^(-gam) - (1+bet)^(-1)*(aa*alph*x(+1)*k^(alph-1) + 1 - delt)*c(+1)^(-gam); // Euler equation |
| 24 |
y_backward=0.2*y_backward(-1)+0.1*y_backward(-2); |
| 25 |
end; |
| 26 |
|
| 27 |
// Set starting value for solver at steady state |
| 28 |
initval; |
| 29 |
x = 1; |
| 30 |
k = ((delt+bet)/(1.0*aa*alph))^(1/(alph-1)); |
| 31 |
c = aa*k^alph-delt*k; |
| 32 |
y_backward=1; |
| 33 |
end; |
| 34 |
steady; |
| 35 |
|
| 36 |
// Set initial conditions for state variables |
| 37 |
histval; |
| 38 |
k(0) = ((delt+bet)/(1.0*aa*alph))^(1/(alph-1)); |
| 39 |
y_backward(0)=1; |
| 40 |
y_backward(-1)=2; |
| 41 |
end; |
| 42 |
|
| 43 |
|
| 44 |
// Check the Blanchard-Kahn conditions |
| 45 |
check; |
| 46 |
|
| 47 |
// Declare a positive technological shock in period 1 |
| 48 |
shocks; |
| 49 |
var x; |
| 50 |
periods 1; |
| 51 |
values 1.2; |
| 52 |
end; |
| 53 |
|
| 54 |
// Deterministic simulation of the model for 200 periods |
| 55 |
perfect_foresight_setup(periods=200); |
| 56 |
perfect_foresight_solver; |
| 57 |
|
| 58 |
if ~oo_.deterministic_simulation.status |
| 59 |
error('Perfect foresight simulation failed') |
| 60 |
end |
| 61 |
|
| 62 |
junk=zeros(1,options_.periods+M_.maximum_lag); |
| 63 |
junk(1)=2; |
| 64 |
junk(2)=1; |
| 65 |
|
| 66 |
for ii=3:options_.periods+M_.maximum_lag+M_.maximum_lead |
| 67 |
junk(ii)=M_.params(strmatch('rho_1',M_.param_names,'exact'))*junk(ii-1)+M_.params(strmatch('rho_2',M_.param_names,'exact'))*junk(ii-2); |
| 68 |
end |
| 69 |
|
| 70 |
if max(abs(junk(M_.maximum_lag+1:end)-oo_.endo_simul(strmatch('y_backward',M_.endo_names,'exact'),1:end-M_.maximum_lead)))>1e-10 |
| 71 |
error('Solution of purely backwards model not correct') |
| 72 |
end |
| 73 |
|
| 74 |
ramst_results=load('../../deterministic_simulations/ramst/Output/ramst_results.mat'); |
| 75 |
if max(abs(ramst_results.oo_.endo_simul(strmatch('k',ramst_results.M_.endo_names,'exact'),1:end-M_.maximum_lead)-oo_.endo_simul(strmatch('k',M_.endo_names,'exact'),1:end-M_.maximum_lead)))>1e-10 |
| 76 |
error('Solution of forward part of the model not correct') |
| 77 |
end |
| 78 |
|
| 79 |
if max(abs(ramst_results.oo_.endo_simul(strmatch('c',ramst_results.M_.endo_names,'exact'),2:end-M_.maximum_lead)-oo_.endo_simul(strmatch('c',M_.endo_names,'exact'),2:end-M_.maximum_lead)))>1e-10 |
| 80 |
error('Solution of forward part of the model not correct') |
| 81 |
end |
| 82 |
|