diff --git a/matlab/dynare_identification.m b/matlab/dynare_identification.m index 75760e81af05d96fe11017eac61876bc909f4ea9..9703de917048cce47d0bc12b1f0d0e1b2ca52b29 100644 --- a/matlab/dynare_identification.m +++ b/matlab/dynare_identification.m @@ -127,6 +127,7 @@ options_.analytic_derivation=1; options_ = set_default_option(options_,'datafile',''); options_.mode_compute = 0; options_.plot_priors = 0; +options_.smoother=1; [dataset_,xparam1, M_, options_, oo_, estim_params_,bayestopt_]=dynare_estimation_init(M_.endo_names,fname_,1, M_, options_, oo_, estim_params_, bayestopt_); options_ident.analytic_derivation_mode = options_.analytic_derivation_mode; if isempty(dataset_), @@ -156,7 +157,7 @@ end % results = prior_sampler(0,M_,bayestopt_,options_,oo_); if prior_exist - if (~isnan(bayestopt_.pshape)) + if any(bayestopt_.pshape > 0) if options_ident.prior_range prior_draw(1,1); else @@ -233,9 +234,9 @@ if iload <=0, % clear xparam1 % end params = set_prior(estim_params_,M_,options_)'; - if isnan(bayestopt_.pshape) - parameters = 'ML_Starting_value'; - disp('Testing ML Starting value') + if all(bayestopt_.pshape == 0) + parameters = 'ML_Starting_value'; + disp('Testing ML Starting value') else switch parameters case 'posterior_mode' @@ -275,10 +276,57 @@ if iload <=0, disp('----------- ') disp('Parameter error:') disp(['The model does not solve for ', parameters, ' with error code info = ', int2str(info(1))]), - disp('Identification stopped ') + disp(' ') + if info(1)==1, + disp('info==1 %! The model doesn''t determine the current variables uniquely.') + elseif info(1)==2, + disp('info==2 %! MJDGGES returned an error code.') + elseif info(1)==3, + disp('info==3 %! Blanchard & Kahn conditions are not satisfied: no stable equilibrium. ') + elseif info(1)==4, + disp('info==4 %! Blanchard & Kahn conditions are not satisfied: indeterminacy. ') + elseif info(1)==5, + disp('info==5 %! Blanchard & Kahn conditions are not satisfied: indeterminacy due to rank failure. ') + elseif info(1)==6, + disp('info==6 %! The jacobian evaluated at the deterministic steady state is complex.') + elseif info(1)==19, + disp('info==19 %! The steadystate routine thrown an exception (inconsistent deep parameters). ') + elseif info(1)==20, + disp('info==20 %! Cannot find the steady state, info(2) contains the sum of square residuals (of the static equations). ') + elseif info(1)==21, + disp('info==21 %! The steady state is complex, info(2) contains the sum of square of imaginary parts of the steady state.') + elseif info(1)==22, + disp('info==22 %! The steady has NaNs. ') + elseif info(1)==23, + disp('info==23 %! M_.params has been updated in the steadystate routine and has complex valued scalars. ') + elseif info(1)==24, + disp('info==24 %! M_.params has been updated in the steadystate routine and has some NaNs. ') + elseif info(1)==30, + disp('info==30 %! Ergodic variance can''t be computed. ') + end disp('----------- ') disp(' ') - return, + if any(bayestopt_.pshape) + disp('Try sampling up to 50 parameter sets from the prior.') + kk=0; + while kk<50 && info(1), + kk=kk+1; + params = prior_draw(); + [idehess_point, idemoments_point, idemodel_point, idelre_point, derivatives_info_point, info] = ... + identification_analysis(params,indx,indexo,options_ident,dataset_, prior_exist, name_tex,1); + end + end + if info(1) + disp(' ') + disp('----------- ') + disp('Identification stopped:') + if any(bayestopt_.pshape) + disp('The model did not solve for any of 50 attempts of random samples from the prior') + end + disp('----------- ') + disp(' ') + return, + end else idehess_point.params=params; % siH = idemodel_point.siH; diff --git a/matlab/identification_analysis.m b/matlab/identification_analysis.m index c8a270c64a7e3227975d39d8d7587b8a0f1e04d6..1e9bda93f4b0000d3a307f01408db396fbd68423 100644 --- a/matlab/identification_analysis.m +++ b/matlab/identification_analysis.m @@ -48,7 +48,9 @@ persistent indH indJJ indLRE nparam=length(params); np=length(indx); offset=nparam-np; -M_ = set_all_parameters(params,estim_params_,M_); +if ~isempty(estim_params_), + M_ = set_all_parameters(params,estim_params_,M_); +end nlags = options_ident.ar; useautocorr = options_ident.useautocorr;