Home > matlab > prior_analysis.m

prior_analysis

PURPOSE ^

Copyright (C) 2009 Dynare Team

SYNOPSIS ^

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

DESCRIPTION ^

 Copyright (C) 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_ = prior_analysis(type,arg1,arg2,arg3,options_,M_,oo_)  
0002 % Copyright (C) 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_prior_analysis_data(type,M_);
0020 SampleSize = options_.prior_mc;
0021 switch info
0022   case {0,1,2}
0023     MaxMegaBytes = options_.MaximumNumberOfMegaBytes;
0024     drsize = size_of_the_reduced_form_model(oo_.dr);
0025     if drsize*SampleSize>MaxMegaBytes
0026         drsave=0;
0027     else
0028         drsave=1;
0029     end
0030     load([M_.dname '/prior/definition.mat']);
0031     prior_sampler(drsave,M_,bayestopt_,options_,oo_);
0032     clear('bayestopt_');
0033     oo_ = job(type,SampleSize,arg1,arg2,arg3,options_,M_,oo_);
0034   case {4,5}
0035     oo_ = job(type,SampleSize,arg1,arg2,arg3,options_,M_,oo_);
0036   case 6
0037     [ivar,vartan] = set_stationary_variables_list(options_,M_);
0038     nvar = length(ivar);
0039     oo_ = job(type,SampleSize,arg1,arg2,arg3,options_,M_,oo_,nvar,vartan);
0040   otherwise
0041     error(['prior_analysis:: Check_prior_analysis_data gave a meaningless output!'])
0042 end
0043 
0044 
0045 
0046 function oo_ = job(type,SampleSize,arg1,arg2,arg3,options_,M_,oo_,nvar,vartan)
0047 narg1 = 8;
0048 narg2 = 10;
0049 if ~(nargin==narg1 || nargin==narg2)
0050     error('prior_analysis:: Call to function job is buggy!')
0051 end
0052 switch type
0053   case 'variance'
0054     if nargin==narg1
0055         [nvar,vartan,NumberOfFiles] = ...
0056             dsge_simulated_theoretical_covariance(SampleSize,M_,options_,oo_,'prior');
0057     end
0058     oo_ = covariance_mc_analysis(SampleSize,'prior',M_.dname,M_.fname,...
0059                                  vartan,nvar,arg1,arg2,options_.mh_conf_sig,oo_);          
0060   case 'decomposition'
0061     if nargin==narg1
0062         [nvar,vartan,NumberOfFiles] = ...
0063             dsge_simulated_theoretical_variance_decomposition(SampleSize,M_,options_,oo_,'prior');
0064     end
0065     oo_ = variance_decomposition_mc_analysis(SampleSize,'prior',M_.dname,M_.fname,...
0066                                              M_.exo_names,arg2,vartan,arg1,options_.mh_conf_sig,oo_);
0067   case 'correlation'
0068     if nargin==narg1
0069         [nvar,vartan,NumberOfFiles] = ...
0070             dsge_simulated_theoretical_correlation(SampleSize,arg3,M_,options_,oo_,'prior');
0071     end
0072     oo_ = correlation_mc_analysis(SampleSize,'prior',M_.dname,M_.fname,...
0073                                   vartan,nvar,arg1,arg2,arg3,options_.mh_conf_sig,oo_,M_,options_);
0074   case 'conditional decomposition'
0075     if nargin==narg1
0076         [nvar,vartan,NumberOfFiles] = ...
0077             dsge_simulated_theoretical_conditional_variance_decomposition(SampleSize,arg3,M_,options_,oo_,'prior');
0078     end
0079     oo_ = conditional_variance_decomposition_mc_analysis(SampleSize,'prior',M_.dname,M_.fname,...
0080                                                       arg3,M_.exo_names,arg2,vartan,arg1,options_.mh_conf_sig,oo_);
0081   otherwise
0082     disp('Not yet implemented')
0083 end

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