| 1 |
@#include "ls2003_model.inc" |
| 2 |
|
| 3 |
estimated_params; |
| 4 |
psi1 , gamma_pdf,1.5,0.5; |
| 5 |
psi2 , gamma_pdf,0.25,0.125; |
| 6 |
psi3 , gamma_pdf,0.25,0.125; |
| 7 |
rho_R ,beta_pdf,0.5,0.2; |
| 8 |
alpha ,beta_pdf,0.3,0.1; |
| 9 |
rr ,gamma_pdf,2.5,1; |
| 10 |
k , gamma_pdf,0.5,0.25; |
| 11 |
tau ,gamma_pdf,0.5,0.2; |
| 12 |
rho_q ,beta_pdf,0.4,0.2; |
| 13 |
rho_A ,beta_pdf,0.5,0.2; |
| 14 |
rho_ys ,beta_pdf,0.8,0.1; |
| 15 |
rho_pies,beta_pdf,0.7,0.15; |
| 16 |
stderr e_R,inv_gamma_pdf,1.2533,0.6551; |
| 17 |
stderr e_q,inv_gamma_pdf,2.5066,1.3103; |
| 18 |
stderr e_A,inv_gamma_pdf,1.2533,0.6551; |
| 19 |
stderr e_ys,inv_gamma_pdf,1.2533,0.6551; |
| 20 |
stderr e_pies,inv_gamma_pdf,1.88,0.9827; |
| 21 |
end; |
| 22 |
|
| 23 |
options_.TeX=true; |
| 24 |
|
| 25 |
disp(' '); |
| 26 |
disp('NOW I DO STABILITY MAPPING and prepare sample for Reduced form Mapping'); |
| 27 |
disp(' '); |
| 28 |
% disp('Press ENTER to continue'); pause(5); |
| 29 |
|
| 30 |
sensitivity(redform=1,nodisplay,Nsam=512); //create sample of reduced form coefficients |
| 31 |
// NOTE: since namendo is empty by default, |
| 32 |
// this call does not perform the mapping of reduced form coefficient: just prepares the sample |
| 33 |
|
| 34 |
disp(' '); |
| 35 |
disp('ANALYSIS OF REDUCED FORM COEFFICIENTS'); |
| 36 |
disp(' '); |
| 37 |
% disp('Press ENTER to continue'); pause(5); |
| 38 |
|
| 39 |
sensitivity(nodisplay, load_stab=1, // load previously generated sample analysed for stability |
| 40 |
redform=1, // do the reduced form mapping |
| 41 |
threshold_redform=[-1 0], // filter reduced form coefficients (default=[]) |
| 42 |
namendo=(pie,R), // evaluate relationships for pie and R (namendo=(:) for all variables) |
| 43 |
namexo=(e_R), // evaluate relationships with exogenous e_R (use namexo=(:) for all shocks) |
| 44 |
namlagendo=(R), // evaluate relationships with lagged R (use namlagendo=(:) for all lagged endogenous) |
| 45 |
stab=0, // don't repeat again the stability mapping |
| 46 |
Nsam=512); |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
disp(' '); |
| 51 |
disp('THE PREVIOUS TWO CALLS COULD BE DONE TOGETHER'); |
| 52 |
disp('BY USING THE COMBINED CALL'); |
| 53 |
disp(' '); |
| 54 |
disp('sensitivity(redform=1,') |
| 55 |
disp('threshold_redform=[-1 0], namendo=(pie,R), namexo=(e_R), namlagendo=(R));') |
| 56 |
disp(' '); |
| 57 |
% disp('Press ENTER to continue'); pause(5); |
| 58 |
//sensitivity( |
| 59 |
//redform=1, //create sample of reduced form coefficients |
| 60 |
//logtrans_redform=1, // estimate log-transformed reduced form coefficients (default=0) |
| 61 |
//namendo=(pie,R), // evaluate relationships for pie and R (namendo=(:) for all variables) |
| 62 |
//namexo=(e_R), // evaluate relationships with exogenous e_R (use namexo=(:) for all shocks) |
| 63 |
//namlagendo=(R) // evaluate relationships with lagged R (use namlagendo=(:) for all lagged endogenous) |
| 64 |
//); |
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
disp(' '); |
| 69 |
disp('MC FILTERING(rmse=1), TO MAP THE FIT FROM PRIORS'); |
| 70 |
%disp('Press ENTER to continue'); pause(5); |
| 71 |
|
| 72 |
sensitivity(nodisplay, datafile='data_ca1.m',first_obs=8,nobs=79,prefilter=1, // also presample=2,loglinear, are admissible |
| 73 |
load_stab=1, // load prior sample |
| 74 |
istart_rmse=2, //start computing rmse from second observation (i.e. rmse does not inlude initial big error) |
| 75 |
stab=0, // don't plot again stability analysis results |
| 76 |
rmse=1, // do rmse analysis |
| 77 |
Nsam=512,kalman_tol=1e-11,use_univariate_smoother_if_singularity_is_detected); |
| 78 |
|
| 79 |
disp(' '); |
| 80 |
disp('THE PREVIOUS THREE CALLS COULD BE DONE TOGETHER'); |
| 81 |
disp('BY USING THE COMBINED CALL'); |
| 82 |
disp(' '); |
| 83 |
disp('sensitivity(redform=1,') |
| 84 |
disp('logtrans_redform=1, namendo=(pie,R), namexo=(e_R), namlagendo=(R),') |
| 85 |
disp('datafile=data_ca1.m,first_obs=8,nobs=79,prefilter=1,') |
| 86 |
disp('istart_rmse=2, rmse=1);') |
| 87 |
disp(' '); |
| 88 |
% disp('Press ENTER to continue'); pause(5); |
| 89 |
//sensitivity( |
| 90 |
//redform=1, //create sample of reduced form coefficients |
| 91 |
//logtrans_redform=1, // estimate log-transformed reduced form coefficients (default=0) |
| 92 |
//namendo=(pie,R), // evaluate relationships for pie and R (namendo=(:) for all variables) |
| 93 |
//namexo=(e_R), // evaluate relationships with exogenous e_R (use namexo=(:) for all shocks) |
| 94 |
//namlagendo=(R), // evaluate relationships with lagged R (use namlagendo=(:) for all lagged endogenous) |
| 95 |
//datafile='data_ca1.m',first_obs=8,nobs=79,prefilter=1, |
| 96 |
//istart_rmse=2, //start computing rmse from second observation (i.e. rmse does not inlude initial big error) |
| 97 |
//rmse=1, // do rmse analysis |
| 98 |
//); |
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
disp(' '); |
| 103 |
disp('I ESTIMATE THE MODEL'); |
| 104 |
disp(' '); |
| 105 |
% disp('Press ENTER to continue'); pause(5); |
| 106 |
|
| 107 |
// run this to generate posterior mode and Metropolis files if not yet done |
| 108 |
estimation(datafile='data_ca1.m',first_obs=8,nobs=79,mh_nblocks=1, |
| 109 |
prefilter=1,mh_jscale=0.5,mh_replic=5000,silent_optimizer, mode_compute=4, mh_drop=0.6, nodisplay, |
| 110 |
bayesian_irf, filtered_vars, smoother) y_obs R_obs pie_obs dq de; |
| 111 |
|
| 112 |
// run this to produce posterior samples of filtered, smoothed and irf variables, if not yet done |
| 113 |
//estimation(datafile='data_ca1.m',first_obs=8,nobs=79,mh_nblocks=2,prefilter=1,mh_jscale=0.3, |
| 114 |
// mh_replic=0, mode_file='ls2003/Output/ls2003_mode', mode_compute=0, load_mh_file, bayesian_irf, |
| 115 |
// filtered_vars, smoother, mh_drop=0.6); |
| 116 |
|
| 117 |
disp(' '); |
| 118 |
disp('WE DO STABILITY MAPPING AGAIN, EXPLORING AROUND THE MODE BY A WIDTH +- 0.2 times the mode'); |
| 119 |
disp('THEN WE DO RMSE analysis in this neighborhood'); |
| 120 |
disp('Typical for ML estimation, also feasible for posterior mode'); |
| 121 |
disp(' '); |
| 122 |
% disp('Press ENTER to continue'); pause(5); |
| 123 |
|
| 124 |
sensitivity(nodisplay, pprior=0,Nsam=512,neighborhood_width=0.2, |
| 125 |
mode_file='ls2003/Output/ls2003_mode', // specifies the mode file where the mode and Hessian are stored |
| 126 |
datafile='data_ca1.m',first_obs=8,nobs=79,prefilter=1, |
| 127 |
rmse=1); |
| 128 |
|
| 129 |
disp(' '); |
| 130 |
disp('WE DO STABILITY MAPPING AGAIN, BUT FOR MULTIVARIATE SAMPLE AT THE POSTERIOR MODE (or ML) and Hessian (pprior=0 & ppost=0)'); |
| 131 |
disp('Typical for ML estimation, also feasible for posterior mode'); |
| 132 |
disp(' '); |
| 133 |
% disp('Press ENTER to continue'); pause(5); |
| 134 |
|
| 135 |
sensitivity(nodisplay, pprior=0,Nsam=512, |
| 136 |
mode_file='ls2003/Output/ls2003_mode' // specifies the mode file where the mode and Hessian are stored |
| 137 |
); |
| 138 |
|
| 139 |
|
| 140 |
disp(' '); |
| 141 |
disp('RMSE ANALYSIS FOR MULTIVARIATE SAMPLE AT THE POSTERIOR MODE'); |
| 142 |
disp(' '); |
| 143 |
disp('Press ENTER to continue'); % pause(5); |
| 144 |
sensitivity(nodisplay, mode_file='ls2003/Output/ls2003_mode', |
| 145 |
datafile='data_ca1.m',first_obs=8,nobs=79,prefilter=1, |
| 146 |
pprior=0, |
| 147 |
stab=0, |
| 148 |
rmse=1, |
| 149 |
alpha2_rmse=0, // no correlation analysis |
| 150 |
alpha_rmse=0, // no Smirnov sensitivity analysis |
| 151 |
Nsam=512); |
| 152 |
|
| 153 |
disp(' '); |
| 154 |
disp('THE LAST TWO CALLS COULD BE DONE TOGETHER'); |
| 155 |
disp('BY USING THE COMBINED CALL'); |
| 156 |
disp(' '); |
| 157 |
disp('sensitivity(pprior=0,Nsam=512,alpha2_stab=0.4,mode_file=ls2003_mode,') |
| 158 |
disp('datafile=data_ca1.m,first_obs=8,nobs=79,prefilter=1,') |
| 159 |
disp('rmse=1, alpha2_rmse=0, alpha_rmse=0);') |
| 160 |
disp(' '); |
| 161 |
% disp('Press ENTER to continue'); pause(5); |
| 162 |
//sensitivity(pprior=0,Nsam=2048,alpha2_stab=0.4,mode_file='ls2003/Output/ls2003_mode', |
| 163 |
//datafile='data_ca1.m',first_obs=8,nobs=79,prefilter=1, |
| 164 |
//rmse=1pae |
| 165 |
//alpha2_rmse=0, // no correlation analysis |
| 166 |
//alpha_rmse=0 // no Smirnov sensitivity analysis |
| 167 |
//); |
| 168 |
|
| 169 |
disp(' '); |
| 170 |
disp('RMSE ANALYSIS FOR POSTERIOR MCMC sample (ppost=1)'); |
| 171 |
disp('Needs a call to dynare_estimation to load all MH environment'); |
| 172 |
% disp('Press ENTER to continue'); pause(5); |
| 173 |
//estimation(datafile='data_ca1.m',first_obs=8,nobs=79,mh_nblocks=2, mode_file='ls2003/Output/ls2003_mode', load_mh_file, |
| 174 |
// prefilter=1,mh_jscale=0.5,mh_replic=0, mode_compute=0, mh_drop=0.6); |
| 175 |
|
| 176 |
sensitivity(nodisplay, stab=0, // no need for stability analysis since the posterior sample is surely OK |
| 177 |
datafile='data_ca1.m',first_obs=8,nobs=79,prefilter=1, |
| 178 |
alpha2_rmse=0, // no correlation analysis |
| 179 |
rmse=1,ppost=1,Nsam=512); |
| 180 |
|
| 181 |
collect_latex_files; |
| 182 |
[status, cmdout]=system(['pdflatex -halt-on-error -interaction=nonstopmode ' M_.fname '_TeX_binder.tex']); |
| 183 |
if status |
| 184 |
cmdout |
| 185 |
error('TeX-File did not compile.') |
| 186 |
end |