From 5707b4d965ad22bd441df9653aa2083ab3af8db9 Mon Sep 17 00:00:00 2001 From: Johannes Pfeifer <jpfeifer@gmx.de> Date: Sun, 18 Dec 2016 11:59:00 +0100 Subject: [PATCH] Make evaluate_smoother.m output former global variables for correct updating of these objects --- matlab/evaluate_smoother.m | 6 ++++-- matlab/shock_decomposition.m | 3 ++- preprocessor/ComputingTasks.cc | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/matlab/evaluate_smoother.m b/matlab/evaluate_smoother.m index 72cf57931..109378662 100644 --- a/matlab/evaluate_smoother.m +++ b/matlab/evaluate_smoother.m @@ -1,4 +1,4 @@ -function [oo_, Smoothed_variables_declaration_order_deviation_form]=evaluate_smoother(parameters,var_list,M_,oo_,options_,bayestopt_,estim_params_) +function [oo_,options_,bayestopt_,Smoothed_variables_declaration_order_deviation_form]=evaluate_smoother(parameters,var_list,M_,oo_,options_,bayestopt_,estim_params_) % Evaluate the smoother at parameters. % % INPUTS @@ -26,6 +26,8 @@ function [oo_, Smoothed_variables_declaration_order_deviation_form]=evaluate_smo % order of declaration of variables (M_.endo_names) % in deviations from their respective mean, i.e. % without trend and constant part (used for shock_decomposition) +% o options_ [structure] Options; returns options_.first_obs +% o bayestopt_ [structure] describing the priors; returns fields like bayestopt_.smoother_var_list from the smoother % % SPECIAL REQUIREMENTS % None @@ -103,7 +105,7 @@ end DsgeSmoother(parameters,dataset_.nobs,transpose(dataset_.data),dataset_info.missing.aindex,dataset_info.missing.state,M_,oo_,options_,bayestopt_,estim_params_); [oo_]=store_smoother_results(M_,oo_,options_,bayestopt_,dataset_,dataset_info,atT,innov,measurement_error,updated_variables,ys,trend_coeff,aK,P,PK,decomp,Trend,state_uncertainty); -if nargout==2 +if nargout==4 Smoothed_variables_declaration_order_deviation_form=atT(oo_.dr.inv_order_var(bayestopt_.smoother_var_list),:); end diff --git a/matlab/shock_decomposition.m b/matlab/shock_decomposition.m index 30e960864..aa61c9b88 100644 --- a/matlab/shock_decomposition.m +++ b/matlab/shock_decomposition.m @@ -66,8 +66,9 @@ if isempty(parameter_set) end end + options_.selected_variables_only = 0; %make sure all variables are stored -[oo,Smoothed_Variables_deviation_from_mean] = evaluate_smoother(parameter_set,varlist,M_,oo_,options_,bayestopt_,estim_params_); +[oo,junk1,junk2,Smoothed_Variables_deviation_from_mean] = evaluate_smoother(parameter_set,varlist,M_,oo_,options_,bayestopt_,estim_params_); % reduced form dr = oo.dr; diff --git a/preprocessor/ComputingTasks.cc b/preprocessor/ComputingTasks.cc index 1a4426208..b3ee1f052 100644 --- a/preprocessor/ComputingTasks.cc +++ b/preprocessor/ComputingTasks.cc @@ -3171,7 +3171,7 @@ CalibSmootherStatement::writeOutput(ostream &output, const string &basename, boo symbol_list.writeOutput("var_list_", output); output << "options_.smoother = 1;" << endl; output << "options_.order = 1;" << endl; - output << "evaluate_smoother('calibration',var_list_,M_,oo_,options_,bayestopt_,estim_params_);" << endl; + output << "[oo_,options_,bayestopt_]=evaluate_smoother('calibration',var_list_,M_,oo_,options_,bayestopt_,estim_params_);" << endl; } ExtendedPathStatement::ExtendedPathStatement(const OptionsList &options_list_arg) -- GitLab