Changed second input of prior_bounds routine.
Do not pass options_ structure but only the required field (prior_trunc).time-shift
parent
8cd35f043e
commit
a1aa2bcd6e
|
@ -77,7 +77,7 @@ if options_.dsge_var
|
||||||
NumberOfLagsTimesNvobs = myinputs.NumberOfLagsTimesNvobs;
|
NumberOfLagsTimesNvobs = myinputs.NumberOfLagsTimesNvobs;
|
||||||
Companion_matrix = myinputs.Companion_matrix;
|
Companion_matrix = myinputs.Companion_matrix;
|
||||||
stock_irf_bvardsge = zeros(options_.irf,nvobs,M_.exo_nbr,MAX_nirfs_dsgevar);
|
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
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -427,7 +427,7 @@ end
|
||||||
|
|
||||||
if (any(bayestopt_.pshape >0 ) && options_.mh_replic) || ...
|
if (any(bayestopt_.pshape >0 ) && options_.mh_replic) || ...
|
||||||
(any(bayestopt_.pshape >0 ) && options_.load_mh_file) %% not ML estimation
|
(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);
|
outside_bound_pars=find(xparam1 < bounds.lb | xparam1 > bounds.ub);
|
||||||
if ~isempty(outside_bound_pars)
|
if ~isempty(outside_bound_pars)
|
||||||
for ii=1:length(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_)
|
plot_priors(bayestopt_,M_,estim_params_,options_)
|
||||||
end
|
end
|
||||||
% Set prior bounds
|
% Set prior bounds
|
||||||
bounds = prior_bounds(bayestopt_,options_);
|
bounds = prior_bounds(bayestopt_, options_.prior_trunc);
|
||||||
bounds.lb = max(bounds.lb,lb);
|
bounds.lb = max(bounds.lb,lb);
|
||||||
bounds.ub = min(bounds.ub,ub);
|
bounds.ub = min(bounds.ub,ub);
|
||||||
else % estimated parameters but no declared priors
|
else % estimated parameters but no declared priors
|
||||||
|
|
|
@ -70,6 +70,6 @@ if isempty(dataset)
|
||||||
[dataset, dataset_info] = makedataset(options_);
|
[dataset, dataset_info] = makedataset(options_);
|
||||||
end
|
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);
|
ldens = evaluate_prior(parameters);
|
||||||
llik = llik - ldens;
|
llik = llik - ldens;
|
|
@ -58,7 +58,7 @@ if init
|
||||||
[junk1,junk2,junk3,lb,ub,junk4] = set_prior(estim_params_,M_,options_); %Prepare bounds
|
[junk1,junk2,junk3,lb,ub,junk4] = set_prior(estim_params_,M_,options_); %Prepare bounds
|
||||||
if ~isempty(bayestopt_) && any(bayestopt_.pshape > 0)
|
if ~isempty(bayestopt_) && any(bayestopt_.pshape > 0)
|
||||||
% Set prior bounds
|
% Set prior bounds
|
||||||
bounds = prior_bounds(bayestopt_,options_);
|
bounds = prior_bounds(bayestopt_, options_.prior_trunc);
|
||||||
bounds.lb = max(bounds.lb,lb);
|
bounds.lb = max(bounds.lb,lb);
|
||||||
bounds.ub = min(bounds.ub,ub);
|
bounds.ub = min(bounds.ub,ub);
|
||||||
else % estimated parameters but no declared priors
|
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),:);
|
pnames = M_.param_names(estim_params_.param_vals(:,1),:);
|
||||||
fname_ = M_.fname;
|
fname_ = M_.fname;
|
||||||
|
|
||||||
bounds = prior_bounds(bayestopt_,options_);
|
bounds = prior_bounds(bayestopt_, options_.prior_trunc);
|
||||||
|
|
||||||
if nargin==0,
|
if nargin==0,
|
||||||
dirname='';
|
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
|
[junk1,junk2,junk3,lb,ub,junk4] = set_prior(estim_params_,M_,options_); %Prepare bounds
|
||||||
if ~isempty(bayestopt_) && any(bayestopt_.pshape > 0)
|
if ~isempty(bayestopt_) && any(bayestopt_.pshape > 0)
|
||||||
% Set prior bounds
|
% Set prior bounds
|
||||||
bounds = prior_bounds(bayestopt_,options_);
|
bounds = prior_bounds(bayestopt_, options_.trunc);
|
||||||
bounds.lb = max(bounds.lb,lb);
|
bounds.lb = max(bounds.lb,lb);
|
||||||
bounds.ub = min(bounds.ub,ub);
|
bounds.ub = min(bounds.ub,ub);
|
||||||
else % estimated parameters but no declared priors
|
else % estimated parameters but no declared priors
|
||||||
|
|
|
@ -147,7 +147,7 @@ if info(1)==0,
|
||||||
info = stoch_simul(char(options_.varobs));
|
info = stoch_simul(char(options_.varobs));
|
||||||
dataset_ = dseries(oo_.endo_simul(options_.varobs_id,100+1:end)',dates('1Q1'), options_.varobs);
|
dataset_ = dseries(oo_.endo_simul(options_.varobs_id,100+1:end)',dates('1Q1'), options_.varobs);
|
||||||
derivatives_info.no_DLIK=1;
|
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,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_);
|
% fval = DsgeLikelihood(xparam1,data_info,options_,M_,estim_params_,bayestopt_,oo_);
|
||||||
options_.analytic_derivation = analytic_derivation;
|
options_.analytic_derivation = analytic_derivation;
|
||||||
|
|
|
@ -38,7 +38,7 @@ T2 = strvcat(T2, l2);
|
||||||
|
|
||||||
prior_trunc_backup = DynareOptions.prior_trunc ;
|
prior_trunc_backup = DynareOptions.prior_trunc ;
|
||||||
DynareOptions.prior_trunc = (1-DynareOptions.prior_interval)/2 ;
|
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 ;
|
DynareOptions.prior_trunc = prior_trunc_backup ;
|
||||||
|
|
||||||
RESIZE = false;
|
RESIZE = false;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
function bounds = prior_bounds(bayestopt,options)
|
function bounds = prior_bounds(bayestopt, prior_trunc)
|
||||||
|
|
||||||
%@info:
|
%@info:
|
||||||
%! @deftypefn {Function File} {@var{bounds} =} prior_bounds (@var{bayesopt},@var{option})
|
%! @deftypefn {Function File} {@var{bounds} =} prior_bounds (@var{bayesopt},@var{option})
|
||||||
|
@ -69,7 +69,6 @@ p3 = bayestopt.p3;
|
||||||
p4 = bayestopt.p4;
|
p4 = bayestopt.p4;
|
||||||
p6 = bayestopt.p6;
|
p6 = bayestopt.p6;
|
||||||
p7 = bayestopt.p7;
|
p7 = bayestopt.p7;
|
||||||
prior_trunc = options.prior_trunc;
|
|
||||||
|
|
||||||
bounds.lb = zeros(length(p6),1);
|
bounds.lb = zeros(length(p6),1);
|
||||||
bounds.ub = zeros(length(p6),1);
|
bounds.ub = zeros(length(p6),1);
|
||||||
|
|
|
@ -51,7 +51,7 @@ if nargin>0 && init
|
||||||
p7 = evalin('base', 'bayestopt_.p7');
|
p7 = evalin('base', 'bayestopt_.p7');
|
||||||
p3 = evalin('base', 'bayestopt_.p3');
|
p3 = evalin('base', 'bayestopt_.p3');
|
||||||
p4 = evalin('base', 'bayestopt_.p4');
|
p4 = evalin('base', 'bayestopt_.p4');
|
||||||
bounds = evalin('base', 'prior_bounds(bayestopt_,options_)');
|
bounds = evalin('base', 'prior_bounds(bayestopt_, options_.prior_trunc)');
|
||||||
lb = bounds.lb;
|
lb = bounds.lb;
|
||||||
ub = bounds.ub;
|
ub = bounds.ub;
|
||||||
number_of_estimated_parameters = length(p6);
|
number_of_estimated_parameters = length(p6);
|
||||||
|
@ -173,6 +173,9 @@ if weibull_draws
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
%@test:1
|
%@test:1
|
||||||
%$ %% Initialize required structures
|
%$ %% Initialize required structures
|
||||||
%$ options_.prior_trunc=0;
|
%$ 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 ];
|
%$ estim_params_.param_vals = [1, NaN, (-Inf), Inf, 1, 0.356, 0.02, NaN, NaN, NaN ];
|
||||||
%$
|
%$
|
||||||
%$ %% beta
|
%$ %% beta
|
||||||
%$ estim_params_.param_vals(1,3)= -Inf;%LB
|
%$ estim_params_.param_vals(1,3)= -Inf; % LB
|
||||||
%$ estim_params_.param_vals(1,4)= +Inf;%UB
|
%$ estim_params_.param_vals(1,4)= +Inf; % UB
|
||||||
%$ estim_params_.param_vals(1,5)= 1;%Shape
|
%$ estim_params_.param_vals(1,5)= 1; % Shape
|
||||||
%$ estim_params_.param_vals(1,6)=0.5;
|
%$ estim_params_.param_vals(1,6)=0.5;
|
||||||
%$ estim_params_.param_vals(1,7)=0.01;
|
%$ estim_params_.param_vals(1,7)=0.01;
|
||||||
%$ estim_params_.param_vals(1,8)=NaN;
|
%$ estim_params_.param_vals(1,8)=NaN;
|
||||||
%$ estim_params_.param_vals(1,9)=NaN;
|
%$ estim_params_.param_vals(1,9)=NaN;
|
||||||
%$
|
%$
|
||||||
%$ [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_)
|
||||||
%$
|
%$
|
||||||
%$ pdraw = prior_draw(1,0);
|
%$ pdraw = prior_draw(1,0); pdraw
|
||||||
%$ pdraw_vec=NaN(ndraws,1);
|
%$ pdraw_vec=NaN(ndraws,1);
|
||||||
%$ for ii=1:ndraws
|
%$ for ii=1:ndraws
|
||||||
%$ pdraw_vec(ii)=prior_draw(0,0);
|
%$ pdraw_vec(ii)=prior_draw(0,0);
|
||||||
|
@ -437,7 +440,7 @@ end
|
||||||
%$ estim_params_.param_vals(1,9)=3;
|
%$ estim_params_.param_vals(1,9)=3;
|
||||||
%$
|
%$
|
||||||
%$ [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_);
|
||||||
%$ bounds = prior_bounds(bayestopt_,options_)';
|
%$ bounds = prior_bounds(bayestopt_,options_.prior_trunc)';
|
||||||
%$
|
%$
|
||||||
%$ pdraw = prior_draw(1,0);
|
%$ pdraw = prior_draw(1,0);
|
||||||
%$ pdraw_vec=NaN(ndraws,1);
|
%$ pdraw_vec=NaN(ndraws,1);
|
||||||
|
@ -459,7 +462,7 @@ end
|
||||||
%$ estim_params_.param_vals(1,9)=NaN;
|
%$ estim_params_.param_vals(1,9)=NaN;
|
||||||
%$
|
%$
|
||||||
%$ [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_);
|
||||||
%$ bounds = prior_bounds(bayestopt_,options_)';
|
%$ bounds = prior_bounds(bayestopt_,options_.prior_trunc)';
|
||||||
%$
|
%$
|
||||||
%$ pdraw = prior_draw(1,0);
|
%$ pdraw = prior_draw(1,0);
|
||||||
%$ pdraw_vec=NaN(ndraws,1);
|
%$ pdraw_vec=NaN(ndraws,1);
|
||||||
|
@ -481,7 +484,7 @@ end
|
||||||
%$ estim_params_.param_vals(1,9)=NaN;
|
%$ estim_params_.param_vals(1,9)=NaN;
|
||||||
%$
|
%$
|
||||||
%$ [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_);
|
||||||
%$ bounds = prior_bounds(bayestopt_,options_)';
|
%$ bounds = prior_bounds(bayestopt_,options_.prior_trunc)';
|
||||||
%$
|
%$
|
||||||
%$ pdraw = prior_draw(1,0);
|
%$ pdraw = prior_draw(1,0);
|
||||||
%$ pdraw_vec=NaN(ndraws,1);
|
%$ pdraw_vec=NaN(ndraws,1);
|
||||||
|
@ -503,7 +506,7 @@ end
|
||||||
%$ estim_params_.param_vals(1,9)=NaN;
|
%$ estim_params_.param_vals(1,9)=NaN;
|
||||||
%$
|
%$
|
||||||
%$ [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_);
|
||||||
%$ bounds = prior_bounds(bayestopt_,options_)';
|
%$ bounds = prior_bounds(bayestopt_,options_.prior_trunc)';
|
||||||
%$
|
%$
|
||||||
%$ pdraw = prior_draw(1,0);
|
%$ pdraw = prior_draw(1,0);
|
||||||
%$ pdraw_vec=NaN(ndraws,1);
|
%$ pdraw_vec=NaN(ndraws,1);
|
||||||
|
@ -526,7 +529,7 @@ end
|
||||||
%$ estim_params_.param_vals(1,9)=NaN;
|
%$ estim_params_.param_vals(1,9)=NaN;
|
||||||
%$
|
%$
|
||||||
%$ [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_);
|
||||||
%$ bounds = prior_bounds(bayestopt_,options_)';
|
%$ bounds = prior_bounds(bayestopt_,options_.prior_trunc)';
|
||||||
%$
|
%$
|
||||||
%$ pdraw = prior_draw(1,0);
|
%$ pdraw = prior_draw(1,0);
|
||||||
%$ pdraw_vec=NaN(ndraws,1);
|
%$ pdraw_vec=NaN(ndraws,1);
|
||||||
|
|
Loading…
Reference in New Issue