Home > matlab > ms-sbvar > ms_write_mhm_input.m

ms_write_mhm_input

PURPOSE ^

function ms_write_mhm_input(fname, options_ms)

SYNOPSIS ^

function ms_write_mhm_input(fname, options_ms)

DESCRIPTION ^

 function ms_write_mhm_input(fname, options_ms)

 INPUTS
    fname:         (string)    filename
    options_ms:    (struct)    options

 OUTPUTS
    none

 SPECIAL REQUIREMENTS
    none

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function ms_write_mhm_input(fname, options_ms)
0002 % function ms_write_mhm_input(fname, options_ms)
0003 %
0004 % INPUTS
0005 %    fname:         (string)    filename
0006 %    options_ms:    (struct)    options
0007 %
0008 % OUTPUTS
0009 %    none
0010 %
0011 % SPECIAL REQUIREMENTS
0012 %    none
0013 
0014 % Copyright (C) 2011 Dynare Team
0015 %
0016 % This file is part of Dynare.
0017 %
0018 % Dynare is free software: you can redistribute it and/or modify
0019 % it under the terms of the GNU General Public License as published by
0020 % the Free Software Foundation, either version 3 of the License, or
0021 % (at your option) any later version.
0022 %
0023 % Dynare is distributed in the hope that it will be useful,
0024 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0025 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0026 % GNU General Public License for more details.
0027 %
0028 % You should have received a copy of the GNU General Public License
0029 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
0030 
0031     fh = fopen(fname,'w');
0032 
0033 
0034     fprintf(fh,'/**********************************************************\n');
0035     fprintf(fh,' *** This input file is read by swzmsbvar_mhm_1 and swzmsbvar_mhm_1.exe only, NOT by swzmsbvar_printdraws.exe.\n');
0036     fprintf(fh,' ***\n');
0037     fprintf(fh,' **********************************************************/\n');
0038 
0039     fprintf(fh,'\n\n//------------- 1st set of posterior draws to find optimal scales for Metropolis (30000). ---------------\n');
0040     fprintf(fh,'//== number draws for first burn-in ==//  //For determining the Metropolis scales only.\n');
0041     fprintf(fh,'%d\n\n',options_ms.draws_nbr_burn_in_1);
0042 
0043     fprintf(fh,'//------------- MCMC burn-in draws once the Metropolis scales (previous stage) are fixed. --------------\n');
0044     fprintf(fh,'//------------- 2nd set of standard burn-in posterior draws to throw away the initial draws (10000). ---------------\n');
0045     fprintf(fh,'//== number draws for second burn-in ==//\n');
0046     fprintf(fh,'%d\n\n',options_ms.draws_nbr_burn_in_2);
0047 
0048     fprintf(fh,'//--------------- 1st set of posterior draws to compute the mean and variance for the weighting function in the MHM (200000) ----------------\n');
0049     fprintf(fh,'//== number draws to estimate mean and variance ==//\n');
0050     fprintf(fh,'%d\n\n',options_ms.draws_nbr_mean_var_estimate);
0051 
0052     fprintf(fh,'//--------------- Only applied to mhm_2 process: total number of MCMC draws = thinning factor * 2nd set of saved posterior draws ----------------\n');
0053     fprintf(fh,'//== thinning factor for modified harmonic mean process ==//\n');
0054     fprintf(fh,'%d\n\n',options_ms.thinning_factor);
0055 
0056     fprintf(fh,'//--------------- 2nd set of saved posterior draws from MHM_2 (second stage): saved draws AFTER thinning (1000000) ----------------\n');
0057     fprintf(fh,'//== number draws for modified harmonic mean process ==//\n');
0058     fprintf(fh,'%d\n\n',options_ms.draws_nbr_modified_harmonic_mean);
0059 
0060     fprintf(fh,'//------- 1st stage: computing all three tightness factors for Dirichlet.  ---------\n');
0061     fprintf(fh,'//------- 2nd stage: hard-code the second scale factor (in principle, we can do all three). ---------\n');
0062     fprintf(fh,'//------- It seems that Dan''s code only use the first element of the following scales.  The scale applies to the Dirichlet''s hyperparameter alpha for the diagonal of the transition matrix in the weighting function.  Note that the weighting function for the transition matrix parameters is Dirichlet. ---------\n');
0063             
0064     fprintf(fh,'//== scale values for Dirichlet distribution ==//\n');
0065     fprintf(fh,'3\n\n');
0066     fprintf(fh,'%f ',options_ms.dirichlet_scale);
0067     fprintf(fh,'\n');
0068     fclose(fh);

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