Debian Codegraph @

tests/estimation/method_of_moments/CET/cet_rwmh.mod

raw
1 % -------------------------------------------------------------------------
2 % Functionality testing of Bayesian IRF matching with
3 % - Random-Walk Metropolis-Hastings
4 % - loading mode files
5 % - whether results are stored and can be accessed in different directories
6 % - reuse previous MCMC to define covariance of proposal
7 % -------------------------------------------------------------------------
8
9 % Copyright © 2023 Dynare Team
10 %
11 % This file is part of Dynare.
12 %
13 % Dynare is free software: you can redistribute it and/or modify
14 % it under the terms of the GNU General Public License as published by
15 % the Free Software Foundation, either version 3 of the License, or
16 % (at your option) any later version.
17 %
18 % Dynare is distributed in the hope that it will be useful,
19 % but WITHOUT ANY WARRANTY; without even the implied warranty of
20 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 % GNU General Public License for more details.
22 %
23 % You should have received a copy of the GNU General Public License
24 % along with Dynare. If not, see <https://www.gnu.org/licenses/>.
25 @#define LESSPARAMS=1
26 @#include "cet_model.inc"
27
28 options_.prior_interval= 0.95;
29
30
31 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
32 %% RUN 1: FIND POSTERIOR MODE USING MODEFILE %%
33 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
34 method_of_moments(mom_method = irf_matching
35 %, add_tiny_number_to_cholesky = 1e-14
36 , additional_optimizer_steps = [4]
37 %, analytic_jacobian
38 %, analytic_standard_errors
39 %, bartlett_kernel_lag
40 %, bounded_shock_support
41 %, brooks_gelman_plotrows
42 , cova_compute=0
43 %, datafile
44 , dirname=cet_rwmh_results_1
45 %, dr
46 %, dr_cycle_reduction_tol
47 %, dr_logarithmic_reduction_maxiter
48 %, dr_logarithmic_reduction_tol
49 %, drop
50 %, first_obs
51 %, geweke_interval
52 %, graph_format
53 %, huge_number
54 , irf_matching_file = cet_irf_matching_file
55 %, k_order_solver
56 %, load_mh_file
57 %, load_results_after_load_mh
58 %, logdata
59 %, lyapunov
60 %, lyapunov_complex_threshold
61 %, lyapunov_doubling_tol
62 %, lyapunov_fixed_point_tol
63 %, mcmc_jumping_covariance
64 , mh_conf_sig = 0.90
65 %, mh_drop = 0.5
66 %, mh_init_scale_factor
67 %, mh_initialize_from_previous_mcmc
68 %, mh_initialize_from_previous_mcmc_directory
69 %, mh_initialize_from_previous_mcmc_prior
70 %, mh_initialize_from_previous_mcmc_record
71 %, mh_jscale = 0.5
72 %, mh_nblocks = 1
73 %, mh_posterior_mode_estimation
74 %, mh_recover
75 , mh_replic=0
76 %, mh_tune_guess = 0.5
77 %, mh_tune_jscale = 0.33
78 %, mom_burnin
79 %, mom_seed
80 %, mom_se_tolx
81 , mode_check
82 %, mode_check_neighbourhood_size
83 %, mode_check_number_of_points
84 , mode_check_symmetric_plots = 0
85 , mode_compute = 4
86 , mode_file = cet_original_mode
87 %, nobs
88 %, no_posterior_kernel_density
89 , nodiagnostic
90 , nodisplay
91 , nograph
92 , noprint
93 %, optim
94 %, order
95 %, penalized_estimator
96 , plot_priors = 1
97 %, posterior_max_subsample_draws
98 %, posterior_sampling_method = 'random_walk_metropolis_hastings'
99 %, posterior_sampler_options = ('proposal_distribution'
100 % ,'rand_multivariate_normal'
101 % ,'rand_multivariate_student'
102 % ,'student_degrees_of_freedom',4
103 % ,'use_mh_covariance_matrix',1
104 % ,'save_tmp_file',1
105 % , scale_file
106 % )
107 %, posterior_sampling_method = 'tailored_random_block_metropolis_hastings'
108 %, posterior_sampler_options = ('proposal_distribution'
109 % ,'rand_multivariate_normal'
110 % ,'rand_multivariate_student'
111 % ,'student_degrees_of_freedom',4
112 % ,'new_block_probability',0.3
113 % ,'mode_compute',1
114 % ,optim
115 % ,'save_tmp_file',1
116 % ,scale_file
117 % )
118 %, posterior_sampling_method = 'independent_metropolis_hastings'
119 %, posterior_sampler_options = ('proposal_distribution'
120 % ,'rand_multivariate_normal'
121 % ,'rand_multivariate_student'
122 % ,'student_degrees_of_freedom',4
123 % ,'use_mh_covariance_matrix',1
124 % ,'save_tmp_file',1
125 % ,scale_file
126 % )
127 %, posterior_sampling_method = 'slice'
128 %, posterior_sampler_options = ('rotated',1
129 % ,'mode_files'
130 % ,'slice_initialize_with_mode',1
131 % ,'initial_step_size',0.8
132 % ,'use_mh_covariance_matrix',1
133 % ,'save_tmp_file',1
134 % )
135 %, prefilter
136 %, prior_trunc
137 %, pruning
138 %, qz_criterium
139 %, qz_zero_threshold
140 %, raftery_lewis_diagnostics
141 %, raftery_lewis_qrs
142 %, relative_irf
143 %, replic
144 %, schur_vec_tol
145 %, silent_optimizer
146 %, simulation_method = stoch_simul
147 %, simulation_multiple
148 %, sub_draws
149 %, sylvester
150 %, sylvester_fixed_point_tol
151 %, taper_steps
152 , tex
153 %, use_penalized_objective_for_hessian
154 , verbose
155 %, weighting_matrix
156 %, weighting_matrix_scaling_factor
157 %, xls_range
158 %, xls_sheet
159 );
160 close all;
161
162
163 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
164 %% RUN 2: LOAD POSTERIOR MODE, COMPUTE HESSIAN AND RUN 1 MCMC CHAIN %%
165 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
166 method_of_moments(mom_method = irf_matching
167 , cova_compute=1
168 , dirname=cet_rwmh_results_2
169 , irf_matching_file = cet_irf_matching_file
170 , mh_conf_sig = 0.95
171 , mh_drop = 0.5
172 , mh_jscale = 0.5
173 , mh_nblocks = 1
174 , mh_replic=200
175 , mode_compute = 0
176 , mode_file = 'cet_rwmh_results_1/method_of_moments/cet_rwmh_mode'
177 , plot_priors = 0
178 , posterior_sampling_method = 'random_walk_metropolis_hastings'
179 , posterior_sampler_options = ('proposal_distribution'
180 ,'rand_multivariate_normal'
181 % ,'rand_multivariate_student'
182 % ,'student_degrees_of_freedom',4
183 % ,'use_mh_covariance_matrix',1
184 % ,'save_tmp_file',1
185 % , scale_file
186 )
187 , tex
188 );
189 close all;
190
191
192 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
193 %% RUN 3: DEFINE COVARIANCE OF PROPOSAL FROM PREVIOUS MCMC %
194 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
195 method_of_moments(mom_method = irf_matching
196 , dirname=cet_rwmh_results_2
197 , irf_matching_file = cet_irf_matching_file
198 , load_mh_file
199 , mh_conf_sig = 0.95
200 , mh_drop = 0.5
201 , mh_jscale = 0.5
202 , mh_nblocks = 1
203 , mh_replic=60
204 , mode_compute = 0
205 , plot_priors = 0
206 , posterior_sampling_method = 'random_walk_metropolis_hastings'
207 , posterior_sampler_options = ('proposal_distribution'
208 % ,'rand_multivariate_normal'
209 ,'rand_multivariate_student'
210 ,'student_degrees_of_freedom',4
211 ,'use_mh_covariance_matrix',1
212 % ,'save_tmp_file',1
213 % , scale_file
214 )
215 , tex
216 );
217
218
219 %%%%%%%%%%%
220 %% LATEX %%
221 %%%%%%%%%%%
222 collect_latex_files;
223 if system(['pdflatex -halt-on-error -interaction=batchmode ' M_.fname '_TeX_binder.tex'])
224 error('TeX-File did not compile.')
225 end