Home > matlab > ms-sbvar > ms_estimation.m

ms_estimation

PURPOSE ^

function [options_, oo_]=ms_estimation(M_, options_, oo_)

SYNOPSIS ^

function [options_, oo_]=ms_estimation(M_, options_, oo_)

DESCRIPTION ^

 function [options_, oo_]=ms_estimation(M_, options_, oo_)
 Markov-switching SBVAR: Estimation

 INPUTS
    M_:          (struct)    model structure
    options_:    (struct)    options
    oo_:         (struct)    results

 OUTPUTS
    options_:    (struct)    options
    oo_:         (struct)    results

 SPECIAL REQUIREMENTS
    none

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [options_, oo_]=ms_estimation(M_, options_, oo_)
0002 % function [options_, oo_]=ms_estimation(M_, options_, oo_)
0003 % Markov-switching SBVAR: Estimation
0004 %
0005 % INPUTS
0006 %    M_:          (struct)    model structure
0007 %    options_:    (struct)    options
0008 %    oo_:         (struct)    results
0009 %
0010 % OUTPUTS
0011 %    options_:    (struct)    options
0012 %    oo_:         (struct)    results
0013 %
0014 % SPECIAL REQUIREMENTS
0015 %    none
0016 
0017 % Copyright (C) 2011 Dynare Team
0018 %
0019 % This file is part of Dynare.
0020 %
0021 % Dynare is free software: you can redistribute it and/or modify
0022 % it under the terms of the GNU General Public License as published by
0023 % the Free Software Foundation, either version 3 of the License, or
0024 % (at your option) any later version.
0025 %
0026 % Dynare is distributed in the hope that it will be useful,
0027 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0028 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0029 % GNU General Public License for more details.
0030 %
0031 % You should have received a copy of the GNU General Public License
0032 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
0033 
0034 disp('MS-SBVAR Estimation');
0035 options_ = set_file_tags(options_);
0036 
0037 % general setup
0038 if options_.ms.create_init
0039     clean_ms_init_files(options_.ms.file_tag);
0040     ms_sbvar_setup(options_);
0041     clean_ms_estimation_files(options_.ms.file_tag);
0042     clean_ms_estimation_files(options_.ms.output_file_tag);
0043 else
0044     if ~strcmp(options_.ms.file_tag, options_.ms.output_file_tag)
0045         clean_ms_estimation_files(options_.ms.output_file_tag);
0046     end
0047 end
0048 
0049 % setup command line options
0050 opt = ['-estimate -seed ' num2str(options_.DynareRandomStreams.seed)];
0051 opt = [opt ' -ft ' options_.ms.file_tag];
0052 opt = [opt ' -fto ' options_.ms.output_file_tag];
0053 opt = [opt ' -cb ' num2str(options_.ms.convergence_starting_value)];
0054 opt = [opt ' -ce ' num2str(options_.ms.convergence_ending_value)];
0055 opt = [opt ' -ci ' num2str(options_.ms.convergence_increment_value)];
0056 opt = [opt ' -ib ' num2str(options_.ms.max_iterations_starting_value)];
0057 opt = [opt ' -ii ' num2str(options_.ms.max_iterations_increment_value)];
0058 opt = [opt ' -mb ' num2str(options_.ms.max_block_iterations)];
0059 opt = [opt ' -repeat_max ' num2str(options_.ms.max_repeated_optimization_runs)];
0060 opt = [opt ' -repeat_tol_obj ' num2str(options_.ms.function_convergence_criterion)];
0061 opt = [opt ' -repeat_tol_parms ' num2str(options_.ms.parameter_convergence_criterion)];
0062 opt = [opt ' -random ' num2str(options_.ms.number_of_large_perturbations)];
0063 opt = [opt ' -random_small ' num2str(options_.ms.number_of_small_perturbations)];
0064 opt = [opt ' -random_small_ndraws ' num2str(options_.ms.number_of_posterior_draws_after_perturbation)];
0065 opt = [opt ' -random_max ' num2str(options_.ms.max_number_of_stages)];
0066 opt = [opt ' -random_tol_obj ' num2str(options_.ms.random_function_convergence_criterion)];
0067 opt = [opt ' -random_tol_parms ' num2str(options_.ms.random_parameter_convergence_criterion)];
0068 
0069 % estimation
0070 [err] = ms_sbvar_command_line(opt);
0071 mexErrCheck('ms_estimation', err);
0072 
0073 [options_, oo_] = set_ms_estimation_file(options_.ms.output_file_tag, options_, oo_);
0074 end

Generated on Tue 22-May-2012 02:40:23 by m2html © 2005