| 1 |
@#include "example1_common.inc" |
| 2 |
|
| 3 |
// Parameter values |
| 4 |
alpha = 0.36; |
| 5 |
rho = 0.5; |
| 6 |
tau = 0.025; |
| 7 |
beta = 0.98; |
| 8 |
delta = 0.025; |
| 9 |
psi = 0; |
| 10 |
theta = 2.95; |
| 11 |
|
| 12 |
phi = 0.1; |
| 13 |
|
| 14 |
shocks; |
| 15 |
var e; stderr 0.009; |
| 16 |
var u; stderr 0.009; |
| 17 |
var e, u = phi*0.009*0.009; |
| 18 |
end; |
| 19 |
|
| 20 |
steady(solve_algo=4,maxit=1000); |
| 21 |
|
| 22 |
stoch_simul(order=1,nofunctions,irf=0,bandpass_filter=[6 32],filtered_theoretical_moments_grid=8192); |
| 23 |
oo_filtered_all_shocks_theoretical=oo_; |
| 24 |
|
| 25 |
stoch_simul(order=1,nofunctions,periods=1000000); |
| 26 |
oo_filtered_all_shocks_simulated=oo_; |
| 27 |
|
| 28 |
|
| 29 |
shocks; |
| 30 |
var e; stderr 0; |
| 31 |
var u; stderr 0.009; |
| 32 |
var e, u = phi*0.009*0; |
| 33 |
end; |
| 34 |
|
| 35 |
stoch_simul(order=1,nofunctions,irf=0,periods=0); |
| 36 |
|
| 37 |
oo_filtered_one_shock_theoretical=oo_; |
| 38 |
|
| 39 |
stoch_simul(order=1,nofunctions,periods=1000000); |
| 40 |
oo_filtered_one_shock_simulated=oo_; |
| 41 |
|
| 42 |
|
| 43 |
if max(abs((1-diag(oo_filtered_one_shock_simulated.var)./(diag(oo_filtered_all_shocks_simulated.var)))*100-oo_filtered_all_shocks_theoretical.variance_decomposition(:,1)))>2 |
| 44 |
error('Variance Decomposition wrong') |
| 45 |
end |
| 46 |
|
| 47 |
if max(max(abs(oo_filtered_all_shocks_simulated.var-oo_filtered_all_shocks_theoretical.var)))>5e-4; |
| 48 |
error('Covariance wrong') |
| 49 |
end |
| 50 |
|
| 51 |
if max(max(abs(oo_filtered_one_shock_simulated.var-oo_filtered_one_shock_theoretical.var)))>5e-4; |
| 52 |
error('Covariance wrong') |
| 53 |
end |
| 54 |
|
| 55 |
for ii=1:options_.ar |
| 56 |
autocorr_model_all_shocks_simulated(:,ii)=diag(oo_filtered_all_shocks_simulated.autocorr{ii}); |
| 57 |
autocorr_model_all_shocks_theoretical(:,ii)=diag(oo_filtered_all_shocks_theoretical.autocorr{ii}); |
| 58 |
autocorr_model_one_shock_simulated(:,ii)=diag(oo_filtered_one_shock_simulated.autocorr{ii}); |
| 59 |
autocorr_model_one_shock_theoretical(:,ii)=diag(oo_filtered_one_shock_theoretical.autocorr{ii}); |
| 60 |
end |
| 61 |
|
| 62 |
if max(max(abs(autocorr_model_all_shocks_simulated-autocorr_model_all_shocks_theoretical)))>0.05; |
| 63 |
error('Correlation wrong') |
| 64 |
end |
| 65 |
|
| 66 |
if max(max(abs(autocorr_model_one_shock_simulated-autocorr_model_one_shock_theoretical)))>0.05; |
| 67 |
error('Correlation wrong') |
| 68 |
end |