Commit 340bcc27 authored by Stéphane Adjemian's avatar Stéphane Adjemian

Added an option for setting the number of points where the posterior kernel is...

Added an option for setting the number of points where the posterior kernel is evaluated when using mode_check. Reorganized the options_ global structure wrt mode_check.
parent ae4df964
......@@ -4462,6 +4462,9 @@ which can be useful if the posterior mode is close to a domain
boundary, or in conjunction with @code{mode_check_neighbourhood_size =
Inf} when the domain in not the entire real line. Default: @code{1}.
@item mode_check_number_of_points = @var{INTEGER}
Number of points around the posterior mode where the posterior kernel is evaluated (for each parameter). Default is @code{20}
@item prior_trunc = @var{DOUBLE}
@anchor{prior_trunc} Probability of extreme values of the prior
density that is ignored when computing bounds for the
......
......@@ -495,7 +495,7 @@ if ~options_.mh_posterior_mode_estimation && options_.cova_compute
end
end
if options_.mode_check == 1 && ~options_.mh_posterior_mode_estimation
if options_.mode_check.status == 1 && ~options_.mh_posterior_mode_estimation
ana_deriv = options_.analytic_derivation;
options_.analytic_derivation = 0;
mode_check(objective_function,xparam1,hh,dataset_,options_,M_,estim_params_,bayestopt_,oo_);
......
......@@ -57,9 +57,11 @@ options_.solve_tolf = eps^(1/3);
options_.solve_tolx = eps^(2/3);
options_.solve_maxit = 500;
options_.mode_check_neighbourhood_size = .5;
options_.mode_check_symmetric_plots = 1;
options_.mode_check_node_number = 1000;
options_.mode_check.status = 0;
options_.mode_check.neighbourhood_size = .5;
options_.mode_check.symmetric_plots = 1;
options_.mode_check.number_of_points = 20;
options_.mode_check.nolik = 0;
% Default number of threads for parallelized mex files.
options_.threads.kronecker.A_times_B_kronecker_C = 1;
......@@ -372,8 +374,7 @@ options_.mh_nblck = 2;
options_.mh_recover = 0;
options_.mh_replic = 20000;
options_.recursive_estimation_restart = 0;
options_.mode_check = 0;
options_.mode_check_nolik = 0;
options_.mode_compute = 4;
options_.mode_file = '';
options_.moments_varendo = 0;
......
......@@ -84,11 +84,10 @@ if TeX
fprintf(fidTeX,' \n');
end
ll = DynareOptions.mode_check_neighbourhood_size;
ll = DynareOptions.mode_check.neighbourhood_size;
if isinf(ll),
DynareOptions.mode_check_symmetric_plots = 0;
DynareOptions.mode_check.symmetric_plots = 0;
end
half_number_nodes = .5*DynareOptions.mode_check_node_number ;
for plt = 1:nbplt,
if TeX
......@@ -112,7 +111,7 @@ for plt = 1:nbplt,
xx = x;
l1 = max(BayesInfo.lb(kk),(1-sign(x(kk))*ll)*x(kk)); m1 = 0;
l2 = min(BayesInfo.ub(kk),(1+sign(x(kk))*ll)*x(kk));
if DynareOptions.mode_check_symmetric_plots,
if DynareOptions.mode_check.symmetric_plots,
if l2<(1+ll)*x(kk)
l1 = x(kk) - (l2-x(kk));
m1 = 1;
......@@ -121,10 +120,10 @@ for plt = 1:nbplt,
l2 = x(kk) + (x(kk)-l1);
end
end
z1 = l1:((x(kk)-l1)/10):x(kk);
z2 = x(kk):((l2-x(kk))/10):l2;
z1 = l1:((x(kk)-l1)/(DynareOptions.mode_check.number_of_points/2)):x(kk);
z2 = x(kk):((l2-x(kk))/(DynareOptions.mode_check.number_of_points/2)):l2;
z = union(z1,z2);
if DynareOptions.mode_check_nolik==0,
if DynareOptions.mode_check.nolik==0,
y = zeros(length(z),2);
dy = priordens(xx,BayesInfo.pshape,BayesInfo.p6,BayesInfo.p7,BayesInfo.p3,BayesInfo.p4);
end
......@@ -136,7 +135,7 @@ for plt = 1:nbplt,
else
y(i,1) = NaN;
end
if DynareOptions.mode_check_nolik==0
if DynareOptions.mode_check.nolik==0
lnprior = priordens(xx,BayesInfo.pshape,BayesInfo.p6,BayesInfo.p7,BayesInfo.p3,BayesInfo.p4);
y(i,2) = (y(i,1)+lnprior-dy);
end
......@@ -154,7 +153,7 @@ for plt = 1:nbplt,
axis tight
drawnow
end
if DynareOptions.mode_check_nolik==0,
if DynareOptions.mode_check.nolik==0,
if exist('OCTAVE_VERSION'),
axes('outerposition',[0.3 0.93 0.42 0.07],'box','on'),
else
......
......@@ -112,7 +112,7 @@ class ParsingDriver;
%token LABELS LAPLACE LIK_ALGO LIK_INIT LINEAR LOAD_IDENT_FILES LOAD_MH_FILE LOAD_PARAMS_AND_STEADY_STATE LOGLINEAR LYAPUNOV
%token LYAPUNOV_FIXED_POINT_TOL LYAPUNOV_DOUBLING_TOL LYAPUNOV_SQUARE_ROOT_SOLVER_TOL LOG_DEFLATOR LOG_TREND_VAR LOG_GROWTH_FACTOR MARKOWITZ MARGINAL_DENSITY MAX MAXIT
%token MFS MH_DROP MH_INIT_SCALE MH_JSCALE MH_MODE MH_NBLOCKS MH_REPLIC MH_RECOVER MIN MINIMAL_SOLVING_PERIODS SOLVE_MAXIT
%token MODE_CHECK MODE_CHECK_NEIGHBOURHOOD_SIZE MODE_CHECK_SYMMETRIC_PLOTS MODE_COMPUTE MODE_FILE MODEL MODEL_COMPARISON MODEL_INFO MSHOCKS ABS SIGN
%token MODE_CHECK MODE_CHECK_NEIGHBOURHOOD_SIZE MODE_CHECK_SYMMETRIC_PLOTS MODE_CHECK_NUMBER_OF_POINTS MODE_COMPUTE MODE_FILE MODEL MODEL_COMPARISON MODEL_INFO MSHOCKS ABS SIGN
%token MODEL_DIAGNOSTICS MODIFIEDHARMONICMEAN MOMENTS_VARENDO DIFFUSE_FILTER SUB_DRAWS
%token <string_val> NAME
%token NAN_CONSTANT NO_STATIC NOBS NOCONSTANT NODISPLAY NOCORR NODIAGNOSTIC NOFUNCTIONS
......@@ -1519,6 +1519,7 @@ estimation_options : o_datafile
| o_mode_check
| o_mode_check_neighbourhood_size
| o_mode_check_symmetric_plots
| o_mode_check_number_of_points
| o_prior_trunc
| o_mh_mode
| o_mh_nblocks
......@@ -2354,9 +2355,10 @@ o_mh_init_scale : MH_INIT_SCALE EQUAL non_negative_number { driver.option_num("m
o_mode_file : MODE_FILE EQUAL filename { driver.option_str("mode_file", $3); };
o_mode_compute : MODE_COMPUTE EQUAL INT_NUMBER { driver.option_num("mode_compute", $3); };
| MODE_COMPUTE EQUAL symbol { driver.option_str("mode_compute", $3); };
o_mode_check : MODE_CHECK { driver.option_num("mode_check", "1"); };
o_mode_check_neighbourhood_size : MODE_CHECK_NEIGHBOURHOOD_SIZE EQUAL signed_number_w_inf { driver.option_num("mode_check_neighbourhood_size", $3); };
o_mode_check_symmetric_plots : MODE_CHECK_SYMMETRIC_PLOTS EQUAL INT_NUMBER { driver.option_num("mode_check_symmetric_plots", $3); };
o_mode_check : MODE_CHECK { driver.option_num("mode_check.status", "1"); };
o_mode_check_neighbourhood_size : MODE_CHECK_NEIGHBOURHOOD_SIZE EQUAL signed_number_w_inf { driver.option_num("mode_check.neighbourhood_size", $3); };
o_mode_check_number_of_points : MODE_CHECK_NUMBER_OF_POINTS EQUAL INT_NUMBER { driver.option_num("mode_check.number_of_points", $3); };
o_mode_check_symmetric_plots : MODE_CHECK_SYMMETRIC_PLOTS EQUAL INT_NUMBER { driver.option_num("mode_check.symmetric_plots", $3); };
o_prior_trunc : PRIOR_TRUNC EQUAL non_negative_number { driver.option_num("prior_trunc", $3); };
o_mh_mode : MH_MODE EQUAL INT_NUMBER { driver.option_num("mh_mode", $3); };
o_mh_nblocks : MH_NBLOCKS EQUAL INT_NUMBER { driver.option_num("mh_nblck", $3); };
......
......@@ -241,6 +241,7 @@ string eofbuff;
<DYNARE_STATEMENT>mode_check {return token::MODE_CHECK;}
<DYNARE_STATEMENT>mode_check_neighbourhood_size {return token::MODE_CHECK_NEIGHBOURHOOD_SIZE;}
<DYNARE_STATEMENT>mode_check_symmetric_plots {return token::MODE_CHECK_SYMMETRIC_PLOTS;}
<DYNARE_STATEMENT>mode_check_number_of_points {return token::MODE_CHECK_NUMBER_OF_POINTS;}
<DYNARE_STATEMENT>prior_trunc {return token::PRIOR_TRUNC;}
<DYNARE_STATEMENT>mh_mode {return token::MH_MODE;}
<DYNARE_STATEMENT>mh_nblocks {return token::MH_NBLOCKS;}
......
Markdown is supported
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