Commit 7d0a55cb authored by Houtan Bastani's avatar Houtan Bastani
Browse files

MS-SBVAR: change syntax for proposal_type option

parent 6d59190d
......@@ -93,7 +93,9 @@ options_.ms.adaptive_mh_draws = 30000;
% mdd
options_.ms.mdd_proposal_draws = 100000;
options_.ms.mdd_use_mean_center = 0;
options_.ms.mdd_proposal_type = [3 0.1 0.9];
options_.ms.proposal_type = 3;
options_.ms.proposal_lower_bound = 0.1;
options_.ms.proposal_upper_bound = 0.9;
% probabilities
options_.ms.filtered_probabilities = 0;
options_.ms.real_time_smoothed_probabilities = 0;
......
......@@ -33,7 +33,7 @@ function [options_, oo_]=ms_compute_mdd(M_, options_, oo_)
disp('MS-SBVAR Marginal Data Density');
options_ = set_file_tags(options_);
clean_ms_mdd_files(options_.ms.output_file_tag, options_.ms.mdd_proposal_type(1));
clean_ms_mdd_files(options_.ms.output_file_tag, options_.ms.proposal_type);
[options_, oo_] = set_ms_estimation_file(options_, oo_);
options_ = set_ms_simulation_file(options_);
......@@ -43,16 +43,12 @@ opt = [opt ' -ft ' options_.ms.simulation_file_tag];
opt = [opt ' -fto ' options_.ms.output_file_tag];
opt = [opt ' -pf ' options_.ms.mh_file];
opt = [opt ' -d ' num2str(options_.ms.mdd_proposal_draws)];
opt = [opt ' -pt ' num2str(options_.ms.proposal_type)];
opt = [opt ' -l ' num2str(options_.ms.proposal_lower_bound)];
opt = [opt ' -h ' num2str(options_.ms.proposal_upper_bound)];
if options_.ms.mdd_use_mean_center
opt = [opt ' -use_mean'];
end
if size(options_.ms.mdd_proposal_type, 2) ~= 3
error('ERROR: mdd_proposal_type takes exactly 3 arguments');
else
opt = [opt ' -pt ' num2str(options_.ms.mdd_proposal_type(1))];
opt = [opt ' -l ' num2str(options_.ms.mdd_proposal_type(2))];
opt = [opt ' -h ' num2str(options_.ms.mdd_proposal_type(3))];
end
% compute mdd
[err] = ms_sbvar_command_line(opt);
......@@ -62,7 +58,7 @@ mexErrCheck('ms_compute_mdd',err);
mull_exp = 'Muller \w+\(\w+\) \= (\d+.\d+e\+\d+)';
bridge_exp = 'Bridge \w+\(\w+\) \= (\d+.\d+e\+\d+)';
bridge_mdd = -1; muller_mdd = -1;
mdd_filename = ['mdd_t' num2str(options_.ms.mdd_proposal_type(1)) '_' options_.ms.output_file_tag '.out'];
mdd_filename = ['mdd_t' num2str(options_.ms.proposal_type) '_' options_.ms.output_file_tag '.out'];
if exist(mdd_filename,'file')
mdd_fid = fopen(mdd_filename);
tline = fgetl(mdd_fid);
......
......@@ -162,7 +162,7 @@ class ParsingDriver;
%token NO_ERROR_BANDS ERROR_BAND_PERCENTILES SHOCKS_PER_PARAMETER NO_CREATE_INIT
%token SHOCK_DRAWS FREE_PARAMETERS MEDIAN DATA_OBS_NBR NEIGHBORHOOD_WIDTH PVALUE_KS PVALUE_CORR
%token FILTERED_PROBABILITIES FILTERED REAL_TIME_SMOOTHED
%token PROPOSAL_TYPE MDD_PROPOSAL_DRAWS MDD_USE_MEAN_CENTER
%token PROPOSAL_TYPE PROPOSAL_UPPER_BOUND PROPOSAL_LOWER_BOUND MDD_PROPOSAL_DRAWS MDD_USE_MEAN_CENTER
%token ADAPTIVE_MH_DRAWS THINNING_FACTOR COEFFICIENTS_PRIOR_HYPERPARAMETERS
%token CONVERGENCE_STARTING_VALUE CONVERGENCE_ENDING_VALUE CONVERGENCE_INCREMENT_VALUE
%token MAX_ITERATIONS_STARTING_VALUE MAX_ITERATIONS_INCREMENT_VALUE MAX_BLOCK_ITERATIONS
......@@ -1579,6 +1579,8 @@ ms_compute_mdd_option : o_output_file_tag
| o_estimation_file_tag
| o_simulation_file_tag
| o_proposal_type
| o_proposal_lower_bound
| o_proposal_upper_bound
| o_mdd_proposal_draws
| o_mdd_use_mean_center
;
......@@ -2133,7 +2135,9 @@ o_thinning_factor : THINNING_FACTOR EQUAL INT_NUMBER { driver.option_num("ms.thi
o_adaptive_mh_draws : ADAPTIVE_MH_DRAWS EQUAL INT_NUMBER { driver.option_num("ms.adaptive_mh_draws",$3); };
o_mdd_proposal_draws : MDD_PROPOSAL_DRAWS EQUAL INT_NUMBER { driver.option_num("ms.mdd_proposal_draws",$3); };
o_mdd_use_mean_center : MDD_USE_MEAN_CENTER { driver.option_num("ms.mdd_use_mean_center","1"); };
o_proposal_type : PROPOSAL_TYPE EQUAL vec_value { driver.option_num("ms.proposal_type",$3); };
o_proposal_type : PROPOSAL_TYPE EQUAL INT_NUMBER { driver.option_num("ms.proposal_type",$3); }
o_proposal_lower_bound : PROPOSAL_LOWER_BOUND EQUAL signed_number { driver.option_num("ms.proposal_lower_bound",$3); }
o_proposal_upper_bound : PROPOSAL_UPPER_BOUND EQUAL signed_number { driver.option_num("ms.proposal_upper_bound",$3); }
o_horizon : HORIZON EQUAL INT_NUMBER { driver.option_num("ms.horizon",$3); };
o_filtered_probabilities : FILTERED_PROBABILITIES { driver.option_num("ms.filtered_probabilities","1"); };
o_real_time_smoothed : REAL_TIME_SMOOTHED { driver.option_num("ms.real_time_smoothed_probabilities","1"); };
......
......@@ -337,6 +337,8 @@ string eofbuff;
<DYNARE_STATEMENT>filtered_probabilities {return token::FILTERED_PROBABILITIES;}
<DYNARE_STATEMENT>real_time_smoothed {return token::REAL_TIME_SMOOTHED;}
<DYNARE_STATEMENT>proposal_type {return token::PROPOSAL_TYPE;}
<DYNARE_STATEMENT>proposal_lower_bound {return token::PROPOSAL_LOWER_BOUND;}
<DYNARE_STATEMENT>proposal_upper_bound {return token::PROPOSAL_UPPER_BOUND;}
<DYNARE_STATEMENT>mdd_proposal_draws {return token::MDD_PROPOSAL_DRAWS;}
<DYNARE_STATEMENT>mdd_use_mean_center {return token::MDD_USE_MEAN_CENTER;}
<DYNARE_STATEMENT>adaptive_mh_draws {return token::ADAPTIVE_MH_DRAWS;}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment