Use global instead of local variable

time-shift
Johannes Pfeifer 2018-12-18 12:44:08 +01:00
parent fc74dded42
commit 5db86aaf7f
1 changed files with 9 additions and 9 deletions

View File

@ -61,11 +61,11 @@ if (size(estim_params_.var_endo,1) || size(estim_params_.corrn,1))
end
% Fill or update bayestopt_ structure
[xparam1, EstimatedParams, BayesOptions, lb, ub, Model] = set_prior(estim_params_, M_, options_);
[xparam1, estim_params_, BayesOptions, lb, ub, Model] = set_prior(estim_params_, M_, options_);
% Set restricted state space
options_plot_priors_old=options_.plot_priors;
options_.plot_priors=0;
[~,~,~,~, M_, options_, oo_, EstimatedParams, BayesOptions] = ...
[~,~,~,~, M_, options_, oo_, estim_params_, BayesOptions] = ...
dynare_estimation_init(M_.endo_names, M_.fname, 1, M_, options_, oo_, estim_params_, bayestopt_);
options_.plot_priors=options_plot_priors_old;
@ -84,20 +84,20 @@ order = options_.order;
options_.order = 1;
if ismember('plot', varargin)
plot_priors(BayesOptions, Model, EstimatedParams, options_)
plot_priors(BayesOptions, Model, estim_params_, options_)
donesomething = true;
end
if ismember('table', varargin)
print_table_prior(lb, ub, options_, Model, BayesOptions, EstimatedParams);
print_table_prior(lb, ub, options_, Model, BayesOptions, estim_params_);
donesomething = true;
end
if ismember('simulate', varargin) % Prior simulations (BK).
if ismember('moments(distribution)', varargin)
results = prior_sampler(1, Model, BayesOptions, options_, oo_, EstimatedParams);
results = prior_sampler(1, Model, BayesOptions, options_, oo_, estim_params_);
else
results = prior_sampler(0, Model, BayesOptions, options_, oo_, EstimatedParams);
results = prior_sampler(0, Model, BayesOptions, options_, oo_, estim_params_);
end
% Display prior mass info
skipline(2)
@ -119,7 +119,7 @@ if ismember('simulate', varargin) % Prior simulations (BK).
end
if ismember('optimize', varargin) % Prior optimization.
optimize_prior(options_, Model, oo_, BayesOptions, EstimatedParams);
optimize_prior(options_, Model, oo_, BayesOptions, estim_params_);
donesomething = true;
end
@ -130,7 +130,7 @@ if ismember('moments', varargin) % Prior simulations (2nd order moments).
k = find(isnan(xparam1));
xparam1(k) = BayesOptions.p1(k);
% Update vector of parameters and covariance matrices
Model = set_all_parameters(xparam1, EstimatedParams, Model);
Model = set_all_parameters(xparam1, estim_params_, Model);
% Check model.
check_model(Model);
% Compute state space representation of the model.
@ -155,7 +155,7 @@ end
if ismember('moments(distribution)', varargin) % Prior simulations (BK).
if ~ismember('simulate', varargin)
results = prior_sampler(1, Model, BayesOptions, options_, oo_, EstimatedParams);
results = prior_sampler(1, Model, BayesOptions, options_, oo_, estim_params_);
end
priorpath = [Model.dname filesep() 'prior' filesep() 'draws' filesep()];
list_of_files = dir([priorpath 'prior_draws*']);