Account for smoother setting parameter count fields in dynare_estimation_init.m
Otherwise, subsequent calls to the smoother will result in crashestime-shift
parent
010b28e237
commit
9a9b8f2a70
|
@ -144,7 +144,7 @@ else
|
||||||
end
|
end
|
||||||
|
|
||||||
% Set priors over the estimated parameters.
|
% Set priors over the estimated parameters.
|
||||||
if ~isempty(estim_params_)
|
if ~isempty(estim_params_) && ~(isfield(estim_params_,'nvx') && sum(estim_params_.nvx+estim_params_.nvn+estim_params_.ncx+estim_params_.ncn+estim_params_.np)==0)
|
||||||
[xparam1,estim_params_,bayestopt_,lb,ub,M_] = set_prior(estim_params_,M_,options_);
|
[xparam1,estim_params_,bayestopt_,lb,ub,M_] = set_prior(estim_params_,M_,options_);
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ if exist([M_.fname '_prior_restrictions.m'])
|
||||||
end
|
end
|
||||||
|
|
||||||
% Check that the provided mode_file is compatible with the current estimation settings.
|
% Check that the provided mode_file is compatible with the current estimation settings.
|
||||||
if ~isempty(estim_params_) && ~isempty(options_.mode_file) && ~options_.mh_posterior_mode_estimation
|
if ~isempty(estim_params_) && ~(isfield(estim_params_,'nvx') && sum(estim_params_.nvx+estim_params_.nvn+estim_params_.ncx+estim_params_.ncn+estim_params_.np)==0) && ~isempty(options_.mode_file) && ~options_.mh_posterior_mode_estimation
|
||||||
number_of_estimated_parameters = length(xparam1);
|
number_of_estimated_parameters = length(xparam1);
|
||||||
mode_file = load(options_.mode_file);
|
mode_file = load(options_.mode_file);
|
||||||
if number_of_estimated_parameters>length(mode_file.xparam1)
|
if number_of_estimated_parameters>length(mode_file.xparam1)
|
||||||
|
@ -289,7 +289,7 @@ if ~isempty(estim_params_) && ~isempty(options_.mode_file) && ~options_.mh_poste
|
||||||
end
|
end
|
||||||
|
|
||||||
%check for calibrated covariances before updating parameters
|
%check for calibrated covariances before updating parameters
|
||||||
if ~isempty(estim_params_)
|
if ~isempty(estim_params_) && ~(isfield(estim_params_,'nvx') && sum(estim_params_.nvx+estim_params_.nvn+estim_params_.ncx+estim_params_.ncn+estim_params_.np)==0)
|
||||||
estim_params_=check_for_calibrated_covariances(xparam1,estim_params_,M_);
|
estim_params_=check_for_calibrated_covariances(xparam1,estim_params_,M_);
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -308,7 +308,7 @@ if options_.use_calibration_initialization %set calibration as starting values
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if ~isempty(estim_params_) && ~all(strcmp(fieldnames(estim_params_),'full_calibration_detected'))
|
if ~isempty(estim_params_) && ~(all(strcmp(fieldnames(estim_params_),'full_calibration_detected')) || (isfield(estim_params_,'nvx') && sum(estim_params_.nvx+estim_params_.nvn+estim_params_.ncx+estim_params_.ncn+estim_params_.np)==0))
|
||||||
if ~isempty(bayestopt_) && any(bayestopt_.pshape > 0)
|
if ~isempty(bayestopt_) && any(bayestopt_.pshape > 0)
|
||||||
% Plot prior densities.
|
% Plot prior densities.
|
||||||
if ~options_.nograph && options_.plot_priors
|
if ~options_.nograph && options_.plot_priors
|
||||||
|
@ -339,7 +339,7 @@ if ~isempty(estim_params_) && ~all(strcmp(fieldnames(estim_params_),'full_calibr
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if isempty(estim_params_) || all(strcmp(fieldnames(estim_params_),'full_calibration_detected'))% If estim_params_ is empty (e.g. when running the smoother on a calibrated model)
|
if isempty(estim_params_) || all(strcmp(fieldnames(estim_params_),'full_calibration_detected')) || (isfield(estim_params_,'nvx') && sum(estim_params_.nvx+estim_params_.nvn+estim_params_.ncx+estim_params_.ncn+estim_params_.np)==0) % If estim_params_ is empty (e.g. when running the smoother on a calibrated model)
|
||||||
if ~options_.smoother
|
if ~options_.smoother
|
||||||
error('Estimation: the ''estimated_params'' block is mandatory (unless you are running a smoother)')
|
error('Estimation: the ''estimated_params'' block is mandatory (unless you are running a smoother)')
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue