Merge branch 'sub_draws' into 'master'

trap error when sub_draws is set to zero

See merge request Dynare/dynare!1699
time-shift
Sébastien Villemot 2020-01-27 17:45:50 +00:00
commit d0dc40c29e
1 changed files with 18 additions and 14 deletions

View File

@ -519,23 +519,27 @@ if (any(bayestopt_.pshape >0 ) && options_.mh_replic) || ...
end end
end end
[error_flag,~,options_]= metropolis_draw(1,options_,estim_params_,M_); [error_flag,~,options_]= metropolis_draw(1,options_,estim_params_,M_);
if options_.bayesian_irf if ~(~isempty(options_.sub_draws) && options_.sub_draws==0)
if error_flag if options_.bayesian_irf
error('Estimation::mcmc: I cannot compute the posterior IRFs!') if error_flag
error('Estimation::mcmc: I cannot compute the posterior IRFs!')
end
PosteriorIRF('posterior');
end end
PosteriorIRF('posterior'); if options_.moments_varendo
end if error_flag
if options_.moments_varendo error('Estimation::mcmc: I cannot compute the posterior moments for the endogenous variables!')
if error_flag end
error('Estimation::mcmc: I cannot compute the posterior moments for the endogenous variables!') oo_ = compute_moments_varendo('posterior',options_,M_,oo_,var_list_);
end end
oo_ = compute_moments_varendo('posterior',options_,M_,oo_,var_list_); if options_.smoother || ~isempty(options_.filter_step_ahead) || options_.forecast
end if error_flag
if options_.smoother || ~isempty(options_.filter_step_ahead) || options_.forecast error('Estimation::mcmc: I cannot compute the posterior statistics!')
if error_flag end
error('Estimation::mcmc: I cannot compute the posterior statistics!') prior_posterior_statistics('posterior',dataset_,dataset_info);
end end
prior_posterior_statistics('posterior',dataset_,dataset_info); else
fprintf('Estimation:mcmc: sub_draws was set to 0. Skipping posterior computations.')
end end
xparam1 = get_posterior_parameters('mean',M_,estim_params_,oo_,options_); xparam1 = get_posterior_parameters('mean',M_,estim_params_,oo_,options_);
M_ = set_all_parameters(xparam1,estim_params_,M_); M_ = set_all_parameters(xparam1,estim_params_,M_);