From 145e2d55420aef022aed80c1d688469994eb398c Mon Sep 17 00:00:00 2001 From: Houtan Bastani Date: Tue, 13 Oct 2015 17:40:15 +0200 Subject: [PATCH] preprocessor: prior_posterior_function: change option 'prior_posterior_sampling_draws' to 'sampling_draws' #1076 --- doc/dynare.texi | 2 +- matlab/execute_prior_posterior_function.m | 2 +- matlab/global_initialization.m | 2 +- preprocessor/ComputingTasks.cc | 8 ++------ preprocessor/DynareBison.yy | 6 +++--- preprocessor/DynareFlex.ll | 2 +- 6 files changed, 9 insertions(+), 13 deletions(-) diff --git a/doc/dynare.texi b/doc/dynare.texi index 4e81be9b6..48f3f3ed2 100644 --- a/doc/dynare.texi +++ b/doc/dynare.texi @@ -12833,7 +12833,7 @@ Executes the user-defined function on draws from the prior. Either this option o @item `posterior' Executes the user-defined function on draws from the posterior. Either this option or the @ref{prior} option is required. -@item prior_posterior_sampling_draws = @var{INTEGER} +@item sampling_draws = @var{INTEGER} Number of draws used for sampling. Default: 500. @end table diff --git a/matlab/execute_prior_posterior_function.m b/matlab/execute_prior_posterior_function.m index a27458d73..c1a4cd921 100644 --- a/matlab/execute_prior_posterior_function.m +++ b/matlab/execute_prior_posterior_function.m @@ -47,7 +47,7 @@ end %Create function handle functionhandle=str2func(posterior_function_name); -n_draws=options_.prior_posterior_sampling_draws; +n_draws=options_.sampling_draws; % Get informations about the _posterior_draws files. if strcmpi(type,'posterior') %% discard first mh_drop percent of the draws: diff --git a/matlab/global_initialization.m b/matlab/global_initialization.m index 41142f29b..40c3ff858 100644 --- a/matlab/global_initialization.m +++ b/matlab/global_initialization.m @@ -297,7 +297,7 @@ options_.xls_range = ''; options_.prior_draws = 10000; % Prior posterior function sampling draws -options_.prior_posterior_sampling_draws = 500; +options_.sampling_draws = 500; options_.forecast = 0; diff --git a/preprocessor/ComputingTasks.cc b/preprocessor/ComputingTasks.cc index 1d0ed9ac2..52b8ffa04 100644 --- a/preprocessor/ComputingTasks.cc +++ b/preprocessor/ComputingTasks.cc @@ -167,17 +167,13 @@ PriorPosteriorFunctionStatement::checkPass(ModFileStructure &mod_file_struct, Wa void PriorPosteriorFunctionStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const { - OptionsList::num_options_t::const_iterator it = - options_list.num_options.find("prior_posterior_sampling_draws"); - if (it != options_list.num_options.end()) - cout << it->first << " = " << it->second << ";" << endl; - + options_list.writeOutput(output); string type = "posterior"; if (options_list.num_options.find("prior") != options_list.num_options.end()) type = "prior"; output << "oo_ = execute_prior_posterior_function(" - << "'" << options_list.string_options.find("function")->second << "'," + << "'" << options_list.string_options.find("function")->second << "', " << "M_, options_, oo_, estim_params_, bayestopt_, dataset_, dataset_info, " << "'" << type << "');" << endl; } diff --git a/preprocessor/DynareBison.yy b/preprocessor/DynareBison.yy index 45f2c9206..fee3fdb38 100644 --- a/preprocessor/DynareBison.yy +++ b/preprocessor/DynareBison.yy @@ -162,7 +162,7 @@ class ParsingDriver; %token SELECTED_VARIABLES_ONLY COVA_COMPUTE SIMULATION_FILE_TAG FILE_TAG %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 REAL_TIME_SMOOTHED PRIOR_POSTERIOR_FUNCTION PRIOR_POSTERIOR_SAMPLING_DRAWS +%token FILTERED_PROBABILITIES REAL_TIME_SMOOTHED PRIOR_POSTERIOR_FUNCTION SAMPLING_DRAWS %token PROPOSAL_TYPE PROPOSAL_UPPER_BOUND PROPOSAL_LOWER_BOUND PROPOSAL_DRAWS USE_MEAN_CENTER %token ADAPTIVE_MH_DRAWS THINNING_FACTOR COEFFICIENTS_PRIOR_HYPERPARAMETERS %token CONVERGENCE_STARTING_VALUE CONVERGENCE_ENDING_VALUE CONVERGENCE_INCREMENT_VALUE @@ -1034,7 +1034,7 @@ prior_posterior_function_options_list : prior_posterior_function_options_list CO prior_posterior_function_options : o_function | o_prior | o_posterior - | o_prior_posterior_sampling_draws + | o_sampling_draws ; simul : SIMUL ';' @@ -3084,7 +3084,7 @@ o_occbin : OCCBIN {driver.option_num("occbin", "1"); }; o_function : FUNCTION EQUAL filename { driver.option_str("function", $3); }; o_prior : PRIOR { driver.option_num("prior", "1"); }; o_posterior : POSTERIOR { driver.option_num("posterior", "1"); }; -o_prior_posterior_sampling_draws : PRIOR_POSTERIOR_SAMPLING_DRAWS EQUAL INT_NUMBER { driver.option_num("prior_posterior_sampling_draws",$3); }; +o_sampling_draws : SAMPLING_DRAWS EQUAL INT_NUMBER { driver.option_num("sampling_draws",$3); }; range : symbol ':' symbol { diff --git a/preprocessor/DynareFlex.ll b/preprocessor/DynareFlex.ll index 72aeb64ec..d64e2fe87 100644 --- a/preprocessor/DynareFlex.ll +++ b/preprocessor/DynareFlex.ll @@ -221,7 +221,7 @@ DATE -?[0-9]+([YyAa]|[Mm]([1-9]|1[0-2])|[Qq][1-4]|[Ww]([1-9]{1}|[1-4][0-9]|5[0-2 std {BEGIN DYNARE_STATEMENT; return token::STD;} corr {BEGIN DYNARE_STATEMENT; return token::CORR;} function {return token::FUNCTION;} -prior_posterior_sampling_draws {return token::PRIOR_POSTERIOR_SAMPLING_DRAWS;} +sampling_draws {return token::SAMPLING_DRAWS;} prior_posterior_function {BEGIN DYNARE_STATEMENT; return token::PRIOR_POSTERIOR_FUNCTION;} /* Inside of a Dynare statement */