From b10b2160ed212106dff3dbc8f3944628dc6dd1e0 Mon Sep 17 00:00:00 2001 From: Johannes Pfeifer <jpfeifer@gmx.de> Date: Thu, 19 Jul 2012 12:30:41 +0200 Subject: [PATCH] Made error message if initial parameter values are outside prior bounds more explicit. --- matlab/dynare_estimation_init.m | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/matlab/dynare_estimation_init.m b/matlab/dynare_estimation_init.m index 954071cfb5..9810e0ec25 100644 --- a/matlab/dynare_estimation_init.m +++ b/matlab/dynare_estimation_init.m @@ -138,9 +138,12 @@ if ~isempty(estim_params_) % Test if initial values of the estimated parameters are all between % the prior lower and upper bounds. if any(xparam1 < bounds(:,1)) || any(xparam1 > bounds(:,2)) - find(xparam1 < bounds(:,1)) - find(xparam1 > bounds(:,2)) - error('Initial parameter values are outside parameter bounds') + outside_bound_vars=bayestopt_.name([find(xparam1 < bounds(:,1)); find(xparam1 > bounds(:,2))],:); + disp_string=[outside_bound_vars{1,:}]; + for ii=2:size(outside_bound_vars,1) + disp_string=[disp_string,', ',outside_bound_vars{ii,:}]; + end + error(['Initial value(s) of ', disp_string ,' are outside parameter bounds. Potentially, you should set prior_trunc=0.']) end lb = bounds(:,1); ub = bounds(:,2); -- GitLab