Account for cases where estim_params_ is empty or has only been filled with field full_calibration_detected

time-shift
Johannes Pfeifer 2015-07-21 11:41:39 +02:00
parent 1a2dbdc4d8
commit 15b47ef50b
2 changed files with 15 additions and 7 deletions

View File

@ -301,7 +301,7 @@ if options_.use_calibration_initialization %set calibration as starting values
[xparam1,estim_params_]=do_parameter_initialization(estim_params_,xparam1_calib,xparam1); %get explicitly initialized parameters that have precedence to calibrated values
end
if ~isempty(estim_params_)
if ~isempty(estim_params_) && ~strmatch(fieldnames(estim_params_),'full_calibration_detected')
if ~isempty(bayestopt_) && any(bayestopt_.pshape > 0)
% Plot prior densities.
if ~options_.nograph && options_.plot_priors
@ -332,7 +332,7 @@ if ~isempty(estim_params_)
end
end
if isempty(estim_params_)% If estim_params_ is empty (e.g. when running the smoother on a calibrated model)
if isempty(estim_params_) || strmatch(fieldnames(estim_params_),'full_calibration_detected')% If estim_params_ is empty (e.g. when running the smoother on a calibrated model)
if ~options_.smoother
error('Estimation: the ''estimated_params'' block is mandatory (unless you are running a smoother)')
end

View File

@ -32,11 +32,19 @@ function xparam1=get_all_parameters(estim_params_,M_)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
nvx = estim_params_.nvx;
ncx = estim_params_.ncx;
nvn = estim_params_.nvn;
ncn = estim_params_.ncn;
np = estim_params_.np;
if ~isempty(estim_params_)
nvx = estim_params_.nvx;
ncx = estim_params_.ncx;
nvn = estim_params_.nvn;
ncn = estim_params_.ncn;
np = estim_params_.np;
else
nvx = 0;
ncx = 0;
nvn = 0;
ncn = 0;
np = 0;
end
Sigma_e = M_.Sigma_e;
Correlation_matrix = M_.Correlation_matrix;
H = M_.H;