MS-SBVAR: rework file cleaning
parent
99c657a619
commit
676f201e5b
|
@ -0,0 +1,39 @@
|
|||
function clean_ms_estimation_files(file_tag)
|
||||
% function clean_ms_estimation_files()
|
||||
% removes MS estimation files
|
||||
%
|
||||
% INPUTS
|
||||
% file_tag: string indicating tag to use when deleting files
|
||||
%
|
||||
% OUTPUTS
|
||||
% none
|
||||
%
|
||||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2011 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
% Dynare is free software: you can redistribute it and/or modify
|
||||
% it under the terms of the GNU General Public License as published by
|
||||
% the Free Software Foundation, either version 3 of the License, or
|
||||
% (at your option) any later version.
|
||||
%
|
||||
% Dynare is distributed in the hope that it will be useful,
|
||||
% but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
% GNU General Public License for more details.
|
||||
%
|
||||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
delete_if_exists(['est_aux_' file_tag '.out']);
|
||||
delete_if_exists(['est_csminwel_' file_tag '.out']);
|
||||
delete_if_exists(['est_final_' file_tag '.out']);
|
||||
delete_if_exists(['est_final_' file_tag '.out.tmp']);
|
||||
delete_if_exists(['est_flat_header_' file_tag '.out']);
|
||||
delete_if_exists(['est_flat_' file_tag '.out']);
|
||||
delete_if_exists(['est_free_' file_tag '.out']);
|
||||
delete_if_exists(['est_intermediate_' file_tag '.out']);
|
||||
end
|
|
@ -1,63 +0,0 @@
|
|||
function clean_ms_files(output_file_tag)
|
||||
% function clean_ms_files()
|
||||
% removes MS intermediary files
|
||||
%
|
||||
% INPUTS
|
||||
% none
|
||||
%
|
||||
% OUTPUTS
|
||||
% none
|
||||
%
|
||||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2007-2011 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
% Dynare is free software: you can redistribute it and/or modify
|
||||
% it under the terms of the GNU General Public License as published by
|
||||
% the Free Software Foundation, either version 3 of the License, or
|
||||
% (at your option) any later version.
|
||||
%
|
||||
% Dynare is distributed in the hope that it will be useful,
|
||||
% but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
% GNU General Public License for more details.
|
||||
%
|
||||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
delete_if_exist(['est_aux_' output_file_tag '.out']);
|
||||
delete_if_exist(['est_csminwel_' output_file_tag '.out']);
|
||||
delete_if_exist(['est_final_' output_file_tag '.out']);
|
||||
delete_if_exist(['est_flat_header_' output_file_tag '.out']);
|
||||
delete_if_exist(['est_flat_' output_file_tag '.out']);
|
||||
delete_if_exist(['est_free_' output_file_tag '.out']);
|
||||
delete_if_exist(['est_intermediate_' output_file_tag '.out']);
|
||||
delete_if_exist(['filtered_' output_file_tag '.out']);
|
||||
delete_if_exist('g1.mat');
|
||||
delete_if_exist('H.dat');
|
||||
delete_if_exist(['init_' output_file_tag '.dat']);
|
||||
delete_if_exist(['matlab_' output_file_tag '.prn']);
|
||||
delete_if_exist(['mdd_t1_' output_file_tag '.out']);
|
||||
delete_if_exist(['proposal_t1_' output_file_tag '.out']);
|
||||
delete_if_exist(['mdd_t2_' output_file_tag '.out']);
|
||||
delete_if_exist(['proposal_t2_' output_file_tag '.out']);
|
||||
delete_if_exist(['mdd_t3_' output_file_tag '.out']);
|
||||
delete_if_exist(['proposal_t3_' output_file_tag '.out']);
|
||||
delete_if_exist(['mdd_t4_' output_file_tag '.out']);
|
||||
delete_if_exist(['proposal_t4_' output_file_tag '.out']);
|
||||
delete_if_exist(['mdd_t5_' output_file_tag '.out']);
|
||||
delete_if_exist(['proposal_t5_' output_file_tag '.out']);
|
||||
delete_if_exist(['simulation_info_' output_file_tag '.out']);
|
||||
delete_if_exist(['simulation_' output_file_tag '.out']);
|
||||
delete_if_exist(['smoothed_' output_file_tag '.out']);
|
||||
delete_if_exist([output_file_tag '_markov_file.dat']);
|
||||
end
|
||||
|
||||
function delete_if_exist(fname)
|
||||
if exist(fname,'file') == 2
|
||||
delete(fname);
|
||||
end
|
||||
end
|
|
@ -0,0 +1,36 @@
|
|||
function clean_ms_init_files(file_tag)
|
||||
% function clean_ms_init_files()
|
||||
% removes MS initialization files
|
||||
%
|
||||
% INPUTS
|
||||
% file_tag: string indicating tag to use when deleting files
|
||||
%
|
||||
% OUTPUTS
|
||||
% none
|
||||
%
|
||||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2011 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
% Dynare is free software: you can redistribute it and/or modify
|
||||
% it under the terms of the GNU General Public License as published by
|
||||
% the Free Software Foundation, either version 3 of the License, or
|
||||
% (at your option) any later version.
|
||||
%
|
||||
% Dynare is distributed in the hope that it will be useful,
|
||||
% but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
% GNU General Public License for more details.
|
||||
%
|
||||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
delete_if_exists('g1.mat');
|
||||
delete_if_exists('H.dat');
|
||||
delete_if_exists(['init_' file_tag '.dat']);
|
||||
delete_if_exists(['matlab_' file_tag '.prn']);
|
||||
delete_if_exists([file_tag '_markov_file.dat']);
|
||||
end
|
|
@ -0,0 +1,34 @@
|
|||
function clean_ms_mdd_files(file_tag, pt)
|
||||
% function clean_ms_mdd_files()
|
||||
% removes MS mdd files
|
||||
%
|
||||
% INPUTS
|
||||
% file_tag: string indicating tag to use when deleting files
|
||||
% pt: numeric proposal type, used to create filename
|
||||
%
|
||||
% OUTPUTS
|
||||
% none
|
||||
%
|
||||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2011 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
% Dynare is free software: you can redistribute it and/or modify
|
||||
% it under the terms of the GNU General Public License as published by
|
||||
% the Free Software Foundation, either version 3 of the License, or
|
||||
% (at your option) any later version.
|
||||
%
|
||||
% Dynare is distributed in the hope that it will be useful,
|
||||
% but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
% GNU General Public License for more details.
|
||||
%
|
||||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
delete_if_exists(['mdd_t' num2str(pt) '_' file_tag '.out']);
|
||||
delete_if_exists(['proposal_t' num2str(pt) '_' file_tag '.out']);
|
||||
end
|
|
@ -0,0 +1,33 @@
|
|||
function clean_ms_probabilities_files(file_tag)
|
||||
% function clean_ms_probabilities_files()
|
||||
% removes MS probabilities files
|
||||
%
|
||||
% INPUTS
|
||||
% file_tag: string indicating tag to use when deleting files
|
||||
%
|
||||
% OUTPUTS
|
||||
% none
|
||||
%
|
||||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2011 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
% Dynare is free software: you can redistribute it and/or modify
|
||||
% it under the terms of the GNU General Public License as published by
|
||||
% the Free Software Foundation, either version 3 of the License, or
|
||||
% (at your option) any later version.
|
||||
%
|
||||
% Dynare is distributed in the hope that it will be useful,
|
||||
% but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
% GNU General Public License for more details.
|
||||
%
|
||||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
delete_if_exists(['smoothed_' file_tag '.out']);
|
||||
delete_if_exists(['filtered_' file_tag '.out']);
|
||||
end
|
|
@ -0,0 +1,33 @@
|
|||
function clean_ms_simulation_files(file_tag)
|
||||
% function clean_ms_simulation_files()
|
||||
% removes MS simulation files
|
||||
%
|
||||
% INPUTS
|
||||
% file_tag: string indicating tag to use when deleting files
|
||||
%
|
||||
% OUTPUTS
|
||||
% none
|
||||
%
|
||||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2011 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
% Dynare is free software: you can redistribute it and/or modify
|
||||
% it under the terms of the GNU General Public License as published by
|
||||
% the Free Software Foundation, either version 3 of the License, or
|
||||
% (at your option) any later version.
|
||||
%
|
||||
% Dynare is distributed in the hope that it will be useful,
|
||||
% but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
% GNU General Public License for more details.
|
||||
%
|
||||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
delete_if_exists(['simulation_' file_tag '.out']);
|
||||
delete_if_exists(['simulation_info_' file_tag '.out']);
|
||||
end
|
|
@ -0,0 +1,37 @@
|
|||
function clean_sbvar_files()
|
||||
%function clean_sbvar_files()
|
||||
% Remove files created by sbvar
|
||||
%
|
||||
% INPUTS
|
||||
% none
|
||||
%
|
||||
% OUTPUTS
|
||||
% none
|
||||
%
|
||||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2010-2011 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
% Dynare is free software: you can redistribute it and/or modify
|
||||
% it under the terms of the GNU General Public License as published by
|
||||
% the Free Software Foundation, either version 3 of the License, or
|
||||
% (at your option) any later version.
|
||||
%
|
||||
% Dynare is distributed in the hope that it will be useful,
|
||||
% but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
% GNU General Public License for more details.
|
||||
%
|
||||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
delete_if_exists('outm.mat');
|
||||
delete_if_exists('g1.mat');
|
||||
delete_if_exists('H.dat');
|
||||
delete_if_exists('outactqmygdata.prn');
|
||||
delete_if_exists('outdata_a0dp_const.mat');
|
||||
delete_if_exists('outyrqm.prn');
|
||||
end
|
|
@ -0,0 +1,34 @@
|
|||
function delete_if_exists(fname)
|
||||
% function delete_if_exists()
|
||||
% removes MS intermediary files
|
||||
%
|
||||
% INPUTS
|
||||
% fname: name of file to attempt to delete
|
||||
%
|
||||
% OUTPUTS
|
||||
% none
|
||||
%
|
||||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2011 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
% Dynare is free software: you can redistribute it and/or modify
|
||||
% it under the terms of the GNU General Public License as published by
|
||||
% the Free Software Foundation, either version 3 of the License, or
|
||||
% (at your option) any later version.
|
||||
%
|
||||
% Dynare is distributed in the hope that it will be useful,
|
||||
% but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
% GNU General Public License for more details.
|
||||
%
|
||||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if exist(fname, 'file') == 2
|
||||
delete(fname);
|
||||
end
|
||||
end
|
|
@ -32,6 +32,7 @@ function [options_, oo_]=ms_compute_mdd(M_, options_, oo_)
|
|||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
disp('Marginal Data Density');
|
||||
clean_ms_mdd_files(options_.ms.output_file_tag,options_.ms.mdd_proposal_type(1));
|
||||
options_ = set_ms_estimation_flags_for_other_mex(options_);
|
||||
options_ = set_ms_simulation_flags_for_other_mex(options_);
|
||||
oo_ = set_oo_w_estimation_output(options_, oo_);
|
||||
|
|
|
@ -34,7 +34,8 @@ function [options_, oo_]=ms_estimation(M_, options_, oo_)
|
|||
disp('Estimation');
|
||||
|
||||
% cleanup old files
|
||||
clean_ms_files(options_.ms.output_file_tag);
|
||||
clean_ms_init_files(options_.ms.output_file_tag);
|
||||
clean_ms_estimation_files(options_.ms.output_file_tag);
|
||||
|
||||
% general setup
|
||||
ms_sbvar_setup(options_);
|
||||
|
|
|
@ -32,6 +32,7 @@ function [options_, oo_]=ms_simulation(M_, options_, oo_)
|
|||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
disp('Simulation');
|
||||
clean_ms_simulation_files(options_.ms.output_file_tag);
|
||||
options_ = set_ms_estimation_flags_for_other_mex(options_);
|
||||
oo_ = set_oo_w_estimation_output(options_, oo_);
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
function sbvar(M, options)
|
||||
|
||||
clean_ms_files(M.fname);
|
||||
clean_sbvar_files();
|
||||
|
||||
options.data = read_variables(options.datafile,options.varobs,[],options.xls_sheet,options.xls_range);
|
||||
|
||||
|
|
Loading…
Reference in New Issue