Commit a1aa2bcd authored by Stéphane Adjemian's avatar Stéphane Adjemian
Browse files

Changed second input of prior_bounds routine.

Do not pass options_ structure but only the required field (prior_trunc).
parent 8cd35f04
......@@ -77,7 +77,7 @@ if options_.dsge_var
NumberOfLagsTimesNvobs = myinputs.NumberOfLagsTimesNvobs;
Companion_matrix = myinputs.Companion_matrix;
stock_irf_bvardsge = zeros(options_.irf,nvobs,M_.exo_nbr,MAX_nirfs_dsgevar);
bounds = prior_bounds(bayestopt_,options_);
bounds = prior_bounds(bayestopt_,options_.prior_trunc);
end
......
......@@ -427,7 +427,7 @@ end
if (any(bayestopt_.pshape >0 ) && options_.mh_replic) || ...
(any(bayestopt_.pshape >0 ) && options_.load_mh_file) %% not ML estimation
bounds = prior_bounds(bayestopt_,options_);
bounds = prior_bounds(bayestopt_, options_.prior_trunc);
outside_bound_pars=find(xparam1 < bounds.lb | xparam1 > bounds.ub);
if ~isempty(outside_bound_pars)
for ii=1:length(outside_bound_pars)
......
......@@ -315,7 +315,7 @@ if ~isempty(estim_params_) && ~all(strcmp(fieldnames(estim_params_),'full_calibr
plot_priors(bayestopt_,M_,estim_params_,options_)
end
% Set prior bounds
bounds = prior_bounds(bayestopt_,options_);
bounds = prior_bounds(bayestopt_, options_.prior_trunc);
bounds.lb = max(bounds.lb,lb);
bounds.ub = min(bounds.ub,ub);
else % estimated parameters but no declared priors
......
......@@ -70,6 +70,6 @@ if isempty(dataset)
[dataset, dataset_info] = makedataset(options_);
end
llik = -dsge_likelihood(parameters,dataset,dataset_info,options_,M_,estim_params_,bayestopt_,prior_bounds(bayestopt_,options_),oo_);
llik = -dsge_likelihood(parameters,dataset,dataset_info,options_,M_,estim_params_,bayestopt_,prior_bounds(bayestopt_,options_.prior_trunc),oo_);
ldens = evaluate_prior(parameters);
llik = llik - ldens;
\ No newline at end of file
......@@ -58,7 +58,7 @@ if init
[junk1,junk2,junk3,lb,ub,junk4] = set_prior(estim_params_,M_,options_); %Prepare bounds
if ~isempty(bayestopt_) && any(bayestopt_.pshape > 0)
% Set prior bounds
bounds = prior_bounds(bayestopt_,options_);
bounds = prior_bounds(bayestopt_, options_.prior_trunc);
bounds.lb = max(bounds.lb,lb);
bounds.ub = min(bounds.ub,ub);
else % estimated parameters but no declared priors
......
......@@ -56,7 +56,7 @@ pvalue_corr = options_gsa_.alpha2_redform;
pnames = M_.param_names(estim_params_.param_vals(:,1),:);
fname_ = M_.fname;
bounds = prior_bounds(bayestopt_,options_);
bounds = prior_bounds(bayestopt_, options_.prior_trunc);
if nargin==0,
dirname='';
......
......@@ -99,7 +99,7 @@ p4 = bayestopt_.p4(nshock+1:end);
[junk1,junk2,junk3,lb,ub,junk4] = set_prior(estim_params_,M_,options_); %Prepare bounds
if ~isempty(bayestopt_) && any(bayestopt_.pshape > 0)
% Set prior bounds
bounds = prior_bounds(bayestopt_,options_);
bounds = prior_bounds(bayestopt_, options_.trunc);
bounds.lb = max(bounds.lb,lb);
bounds.ub = min(bounds.ub,ub);
else % estimated parameters but no declared priors
......
......@@ -147,7 +147,7 @@ if info(1)==0,
info = stoch_simul(char(options_.varobs));
dataset_ = dseries(oo_.endo_simul(options_.varobs_id,100+1:end)',dates('1Q1'), options_.varobs);
derivatives_info.no_DLIK=1;
bounds = prior_bounds(bayestopt_,options_);
bounds = prior_bounds(bayestopt_, options_.prior_trunc);
[fval,DLIK,AHess,cost_flag,ys,trend_coeff,info,M_,options_,bayestopt_,oo_] = dsge_likelihood(params',dataset_,dataset_info,options_,M_,estim_params_,bayestopt_,bounds,oo_,derivatives_info);
% fval = DsgeLikelihood(xparam1,data_info,options_,M_,estim_params_,bayestopt_,oo_);
options_.analytic_derivation = analytic_derivation;
......
......@@ -38,7 +38,7 @@ T2 = strvcat(T2, l2);
prior_trunc_backup = DynareOptions.prior_trunc ;
DynareOptions.prior_trunc = (1-DynareOptions.prior_interval)/2 ;
PriorIntervals = prior_bounds(BayesInfo,DynareOptions) ;
PriorIntervals = prior_bounds(BayesInfo, DynareOptions.prior_trunc) ;
DynareOptions.prior_trunc = prior_trunc_backup ;
RESIZE = false;
......
function bounds = prior_bounds(bayestopt,options)
function bounds = prior_bounds(bayestopt, prior_trunc)
%@info:
%! @deftypefn {Function File} {@var{bounds} =} prior_bounds (@var{bayesopt},@var{option})
......@@ -69,7 +69,6 @@ p3 = bayestopt.p3;
p4 = bayestopt.p4;
p6 = bayestopt.p6;
p7 = bayestopt.p7;
prior_trunc = options.prior_trunc;
bounds.lb = zeros(length(p6),1);
bounds.ub = zeros(length(p6),1);
......
......@@ -51,7 +51,7 @@ if nargin>0 && init
p7 = evalin('base', 'bayestopt_.p7');
p3 = evalin('base', 'bayestopt_.p3');
p4 = evalin('base', 'bayestopt_.p4');
bounds = evalin('base', 'prior_bounds(bayestopt_,options_)');
bounds = evalin('base', 'prior_bounds(bayestopt_, options_.prior_trunc)');
lb = bounds.lb;
ub = bounds.ub;
number_of_estimated_parameters = length(p6);
......@@ -173,6 +173,9 @@ if weibull_draws
end
end
%@test:1
%$ %% Initialize required structures
%$ options_.prior_trunc=0;
......@@ -190,17 +193,17 @@ end
%$ estim_params_.param_vals = [1, NaN, (-Inf), Inf, 1, 0.356, 0.02, NaN, NaN, NaN ];
%$
%$ %% beta
%$ estim_params_.param_vals(1,3)= -Inf;%LB
%$ estim_params_.param_vals(1,4)= +Inf;%UB
%$ estim_params_.param_vals(1,5)= 1;%Shape
%$ estim_params_.param_vals(1,3)= -Inf; % LB
%$ estim_params_.param_vals(1,4)= +Inf; % UB
%$ estim_params_.param_vals(1,5)= 1; % Shape
%$ estim_params_.param_vals(1,6)=0.5;
%$ estim_params_.param_vals(1,7)=0.01;
%$ estim_params_.param_vals(1,8)=NaN;
%$ estim_params_.param_vals(1,9)=NaN;
%$
%$ [xparam1, estim_params_, bayestopt_, lb, ub, M_]=set_prior(estim_params_, M_, options_);
%$
%$ pdraw = prior_draw(1,0);
%$ [xparam1, estim_params_, bayestopt_, lb, ub, M_]=set_prior(estim_params_, M_, options_)
%$
%$ pdraw = prior_draw(1,0); pdraw
%$ pdraw_vec=NaN(ndraws,1);
%$ for ii=1:ndraws
%$ pdraw_vec(ii)=prior_draw(0,0);
......@@ -437,7 +440,7 @@ end
%$ estim_params_.param_vals(1,9)=3;
%$
%$ [xparam1, estim_params_, bayestopt_, lb, ub, M_]=set_prior(estim_params_, M_, options_);
%$ bounds = prior_bounds(bayestopt_,options_)';
%$ bounds = prior_bounds(bayestopt_,options_.prior_trunc)';
%$
%$ pdraw = prior_draw(1,0);
%$ pdraw_vec=NaN(ndraws,1);
......@@ -459,7 +462,7 @@ end
%$ estim_params_.param_vals(1,9)=NaN;
%$
%$ [xparam1, estim_params_, bayestopt_, lb, ub, M_]=set_prior(estim_params_, M_, options_);
%$ bounds = prior_bounds(bayestopt_,options_)';
%$ bounds = prior_bounds(bayestopt_,options_.prior_trunc)';
%$
%$ pdraw = prior_draw(1,0);
%$ pdraw_vec=NaN(ndraws,1);
......@@ -481,7 +484,7 @@ end
%$ estim_params_.param_vals(1,9)=NaN;
%$
%$ [xparam1, estim_params_, bayestopt_, lb, ub, M_]=set_prior(estim_params_, M_, options_);
%$ bounds = prior_bounds(bayestopt_,options_)';
%$ bounds = prior_bounds(bayestopt_,options_.prior_trunc)';
%$
%$ pdraw = prior_draw(1,0);
%$ pdraw_vec=NaN(ndraws,1);
......@@ -503,7 +506,7 @@ end
%$ estim_params_.param_vals(1,9)=NaN;
%$
%$ [xparam1, estim_params_, bayestopt_, lb, ub, M_]=set_prior(estim_params_, M_, options_);
%$ bounds = prior_bounds(bayestopt_,options_)';
%$ bounds = prior_bounds(bayestopt_,options_.prior_trunc)';
%$
%$ pdraw = prior_draw(1,0);
%$ pdraw_vec=NaN(ndraws,1);
......@@ -526,7 +529,7 @@ end
%$ estim_params_.param_vals(1,9)=NaN;
%$
%$ [xparam1, estim_params_, bayestopt_, lb, ub, M_]=set_prior(estim_params_, M_, options_);
%$ bounds = prior_bounds(bayestopt_,options_)';
%$ bounds = prior_bounds(bayestopt_,options_.prior_trunc)';
%$
%$ pdraw = prior_draw(1,0);
%$ pdraw_vec=NaN(ndraws,1);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment