From bac43d527ffca14eb429f021ecd37b9c0e69b189 Mon Sep 17 00:00:00 2001
From: Marco Ratto <marco.ratto@ec.europa.eu>
Date: Thu, 26 Jan 2023 09:27:07 +0100
Subject: [PATCH] evaluate set_prior only when needed

(cherry picked from commit 783c237d1799c7047bbf2293c2c6cce4a5c215ca)
---
 matlab/evaluate_likelihood.m | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/matlab/evaluate_likelihood.m b/matlab/evaluate_likelihood.m
index 0dbd29bba1..692588145c 100644
--- a/matlab/evaluate_likelihood.m
+++ b/matlab/evaluate_likelihood.m
@@ -73,7 +73,6 @@ if isempty(dataset)
 end
 options_=select_qz_criterium_value(options_);
 
-[~,~,~,lb,ub] = set_prior(estim_params_,M_,options_);
 if ~isempty(bayestopt_) && any(bayestopt_.pshape > 0)
     % Plot prior densities.
     % Set prior bounds
@@ -81,6 +80,7 @@ if ~isempty(bayestopt_) && any(bayestopt_.pshape > 0)
 else  % estimated parameters but no declared priors
     % No priors are declared so Dynare will estimate the model by
     % maximum likelihood with inequality constraints for the parameters.
+    [~,~,~,lb,ub] = set_prior(estim_params_,M_,options_);
     bounds.lb = lb;
     bounds.ub = ub;
 end
-- 
GitLab