Home > matlab > posterior_analysis.m

posterior_analysis

PURPOSE ^

Copyright (C) 2008-2009 Dynare Team

SYNOPSIS ^

function oo_ = posterior_analysis(type,arg1,arg2,arg3,options_,M_,oo_)

DESCRIPTION ^

 Copyright (C) 2008-2009 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/>.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function oo_ = posterior_analysis(type,arg1,arg2,arg3,options_,M_,oo_)  
0002 % Copyright (C) 2008-2009 Dynare Team
0003 %
0004 % This file is part of Dynare.
0005 %
0006 % Dynare is free software: you can redistribute it and/or modify
0007 % it under the terms of the GNU General Public License as published by
0008 % the Free Software Foundation, either version 3 of the License, or
0009 % (at your option) any later version.
0010 %
0011 % Dynare is distributed in the hope that it will be useful,
0012 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0013 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014 % GNU General Public License for more details.
0015 %
0016 % You should have received a copy of the GNU General Public License
0017 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
0018 
0019 info = check_posterior_analysis_data(type,M_);
0020 SampleSize = options_.PosteriorSampleSize;
0021 switch info
0022   case 0
0023     disp('check_posterior_analysis_data:: Can''t find any mcmc file!')
0024     error('Check the options of the estimation command...')
0025   case {1,2}
0026     MaxMegaBytes = options_.MaximumNumberOfMegaBytes;
0027     drsize = size_of_the_reduced_form_model(oo_.dr);
0028     if drsize*SampleSize>MaxMegaBytes
0029         drsize=0;
0030     end
0031     SampleAddress = selec_posterior_draws(SampleSize,drsize);
0032     oo_ = job(type,SampleSize,arg1,arg2,arg3,options_,M_,oo_);
0033   case {4,5}
0034     oo_ = job(type,SampleSize,arg1,arg2,arg3,options_,M_,oo_);
0035   case 6
0036     [ivar,vartan] = set_stationary_variables_list(options_,M_);
0037     nvar = length(ivar);
0038     oo_ = job(type,SampleSize,arg1,arg2,arg3,options_,M_,oo_,nvar,vartan);
0039   otherwise
0040     error(['posterior_analysis:: Check_posterior_analysis_data gave a meaningless output!'])
0041 end
0042 
0043 
0044 
0045 function oo_ = job(type,SampleSize,arg1,arg2,arg3,options_,M_,oo_,nvar,vartan)
0046 narg1 = 8;
0047 narg2 = 10;
0048 if ~(nargin==narg1 || nargin==narg2)
0049     error('posterior_analysis:: Call to function job is buggy!')
0050 end
0051 switch type
0052   case 'variance'
0053     if nargin==narg1
0054         [nvar,vartan,NumberOfFiles] = ...
0055             dsge_simulated_theoretical_covariance(SampleSize,M_,options_,oo_,'posterior');
0056     end
0057     oo_ = covariance_mc_analysis(SampleSize,'posterior',M_.dname,M_.fname,...
0058                                  vartan,nvar,arg1,arg2,options_.mh_conf_sig,oo_);          
0059   case 'decomposition'
0060     if nargin==narg1
0061         [nvar,vartan,NumberOfFiles] = ...
0062             dsge_simulated_theoretical_variance_decomposition(SampleSize,M_,options_,oo_,'posterior');
0063     end
0064     oo_ = variance_decomposition_mc_analysis(SampleSize,'posterior',M_.dname,M_.fname,...
0065                                              M_.exo_names,arg2,vartan,arg1,options_.mh_conf_sig,oo_);
0066   case 'correlation'
0067     if nargin==narg1
0068         [nvar,vartan,NumberOfFiles] = ...
0069             dsge_simulated_theoretical_correlation(SampleSize,arg3,M_,options_,oo_,'posterior');
0070     end
0071     oo_ = correlation_mc_analysis(SampleSize,'posterior',M_.dname,M_.fname,...
0072                                   vartan,nvar,arg1,arg2,arg3,options_.mh_conf_sig,oo_,M_,options_);
0073   case 'conditional decomposition'
0074     if nargin==narg1
0075         [nvar,vartan,NumberOfFiles] = ...
0076             dsge_simulated_theoretical_conditional_variance_decomposition(SampleSize,arg3,M_,options_,oo_,'posterior');
0077     end
0078     oo_ = conditional_variance_decomposition_mc_analysis(SampleSize,'posterior',M_.dname,M_.fname,...
0079                                                       arg3,M_.exo_names,arg2,vartan,arg1,options_.mh_conf_sig,oo_);
0080   otherwise
0081     disp('Not yet implemented')
0082 end

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