Commit 742ed027 authored by Houtan Bastani's avatar Houtan Bastani
Browse files

MS-SBVAR: rework set_ms_estimation to match different meanings of file_tag

parent 38587195
......@@ -34,7 +34,7 @@ function [options_, oo_]=ms_compute_mdd(M_, options_, oo_)
disp('MS-SBVAR Marginal Data Density');
options_ = set_file_tags(options_);
clean_ms_mdd_files(options_.ms.output_file_tag, options_.ms.proposal_type);
[options_, oo_] = set_ms_estimation_file(options_, oo_);
[options_, oo_] = set_ms_estimation_file(options_.ms.file_tag, options_, oo_);
options_ = set_ms_simulation_file(options_);
% setup command line options
......
......@@ -34,7 +34,7 @@ function [options_, oo_]=ms_compute_probabilities(M_, options_, oo_)
disp('MS-SBVAR Compute Regime Probabilities');
options_ = set_file_tags(options_);
clean_ms_probabilities_files(options_.ms.output_file_tag);
[options_, oo_] = set_ms_estimation_file(options_, oo_);
[options_, oo_] = set_ms_estimation_file(options_.ms.file_tag, options_, oo_);
% setup command line options
opt = ['-probabilities -seed ' num2str(options_.DynareRandomStreams.seed)];
......
......@@ -70,7 +70,7 @@ opt = [opt ' -random_tol_parms ' num2str(options_.ms.random_parameter_convergenc
[err] = ms_sbvar_command_line(opt);
mexErrCheck('ms_estimation', err);
[options_, oo_] = set_ms_estimation_file(options_, oo_);
[options_, oo_] = set_ms_estimation_file(options_.ms.output_file_tag, options_, oo_);
[err, oo_.ms.A0, oo_.ms.Aplus, oo_.ms.Zeta, oo_.ms.Q] = ...
mex_ms_convert_free_parameters({{'file_tag',options_.ms.output_file_tag}}, oo_.ms.maxparams);
mexErrCheck('mex_ms_convert_free_parameters', err);
......
......@@ -33,7 +33,7 @@ function [options_, oo_]=ms_forecast(M_, options_, oo_)
disp('MS-SBVAR Forecasts');
options_ = set_file_tags(options_);
[options_, oo_] = set_ms_estimation_file(options_, oo_);
[options_, oo_] = set_ms_estimation_file(options_.ms.file_tag, options_, oo_);
options_ = set_ms_simulation_file(options_);
clean_files_for_second_type_of_mex(M_, options_, 'forecast')
forecastdir = [options_.ms.output_file_tag filesep 'Forecast'];
......
......@@ -34,7 +34,7 @@ function [options_, oo_]=ms_irf(varlist,M_, options_, oo_)
disp('MS-SBVAR Impulse Response Function');
options_ = set_file_tags(options_);
[options_, oo_] = set_ms_estimation_file(options_, oo_);
[options_, oo_] = set_ms_estimation_file(options_.ms.file_tag, options_, oo_);
options_ = set_ms_simulation_file(options_);
clean_files_for_second_type_of_mex(M_, options_, 'irf')
irfdir = [options_.ms.output_file_tag filesep 'IRF'];
......
......@@ -34,7 +34,7 @@ function [options_, oo_]=ms_simulation(M_, options_, oo_)
disp('MS-SBVAR Simulation');
options_ = set_file_tags(options_);
clean_ms_simulation_files(options_.ms.output_file_tag);
[options_, oo_] = set_ms_estimation_file(options_, oo_);
[options_, oo_] = set_ms_estimation_file(options_.ms.file_tag, options_, oo_);
% setup command line options
opt = ['-simulate -seed ' num2str(options_.DynareRandomStreams.seed)];
......
......@@ -33,7 +33,7 @@ function [options_, oo_]=ms_variance_decomposition(M_, options_, oo_)
disp('MS-SBVAR Variance Decomposition');
options_ = set_file_tags(options_);
[options_, oo_] = set_ms_estimation_file(options_, oo_);
[options_, oo_] = set_ms_estimation_file(options_.ms.file_tag, options_, oo_);
options_ = set_ms_simulation_file(options_);
clean_files_for_second_type_of_mex(M_, options_, 'variance_decomposition')
vddir = [options_.ms.output_file_tag filesep 'Variance_Decomposition'];
......
function [options_, oo_]=set_ms_estimation_file(options_, oo_)
function [options_, oo_]=set_ms_estimation_file(file_tag, options_, oo_)
%function set_ms_estimation_file()
% Set options_.ms.free_param_file based on user input
%
% INPUTS
% file_tag: (string) necessary because of different meanings of
% file_tag between ms_estimation and other ms_*
% routines
% options_: (struct) options
% oo_: (struct) results
%
......@@ -30,7 +33,7 @@ function [options_, oo_]=set_ms_estimation_file(options_, oo_)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
options_.ms.free_param_file = ['est_free_' options_.ms.file_tag '.out'];
options_.ms.free_param_file = ['est_free_' file_tag '.out'];
if ~exist(options_.ms.free_param_file,'file')
error(['ERROR: Could not find free parameter file: ' options_.ms.free_param_file]);
end
......
Markdown is supported
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