Home > matlab > plot_priors.m

plot_priors

PURPOSE ^

function plot_priors

SYNOPSIS ^

function plot_priors(bayestopt_,M_,estim_params_,options_)

DESCRIPTION ^

 function plot_priors
 plots prior density

 INPUTS
    o bayestopt_  [structure]
    o M_          [structure]
    o options_    [structure]

 OUTPUTS
    None

 SPECIAL REQUIREMENTS
    None

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function plot_priors(bayestopt_,M_,estim_params_,options_)
0002 % function plot_priors
0003 % plots prior density
0004 %
0005 % INPUTS
0006 %    o bayestopt_  [structure]
0007 %    o M_          [structure]
0008 %    o options_    [structure]
0009 %
0010 % OUTPUTS
0011 %    None
0012 %
0013 % SPECIAL REQUIREMENTS
0014 %    None
0015 
0016 % Copyright (C) 2004-2010 Dynare Team
0017 %
0018 % This file is part of Dynare.
0019 %
0020 % Dynare is free software: you can redistribute it and/or modify
0021 % it under the terms of the GNU General Public License as published by
0022 % the Free Software Foundation, either version 3 of the License, or
0023 % (at your option) any later version.
0024 %
0025 % Dynare is distributed in the hope that it will be useful,
0026 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0027 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0028 % GNU General Public License for more details.
0029 %
0030 % You should have received a copy of the GNU General Public License
0031 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
0032 
0033 TeX = options_.TeX;
0034 
0035 figurename = 'Priors';
0036 npar = length(bayestopt_.p1);
0037 [nbplt,nr,nc,lr,lc,nstar] = pltorg(npar);
0038 
0039 if TeX
0040     fidTeX = fopen([M_.fname '_Priors.TeX'],'w');
0041     fprintf(fidTeX,'%% TeX eps-loader file generated by plot_priors.m (Dynare).\n');
0042     fprintf(fidTeX,['%% ' datestr(now,0) '\n']);
0043     fprintf(fidTeX,' \n');
0044 end
0045 for plt = 1:nbplt,
0046     hplt = dyn_figure(options_,'Name',figurename);
0047     if TeX
0048         TeXNAMES = [];
0049         NAMES    = [];
0050     end
0051     nstar0 = min(nstar,npar-(plt-1)*nstar);
0052     for index=1:nstar0
0053         names = [];
0054         i = (plt-1)*nstar + index;
0055         [x,f,abscissa,dens,binf,bsup] = draw_prior_density(i,bayestopt_);
0056         [nam,texnam] = get_the_name(i,TeX,M_,estim_params_,options_);
0057         if TeX
0058             if index==1
0059                 TeXNAMES = texnam;
0060                 NAMES = nam;
0061             else
0062                 TeXNAMES = char(TeXNAMES,texnam);
0063                 NAMES = char(NAMES,nam);
0064             end
0065         end
0066         subplot(nr,nc,index)
0067         hh = plot(x,f,'-k','linewidth',2);
0068         set(hh,'color',[0.7 0.7 0.7]);
0069         box on
0070         title(nam,'Interpreter','none')
0071         drawnow
0072     end
0073     dyn_saveas(hplt,[M_.fname '_Priors' int2str(plt)],options_);
0074     if TeX
0075         fprintf(fidTeX,'\\begin{figure}[H]\n');
0076         for jj = 1:nstar0,
0077             fprintf(fidTeX,'\\psfrag{%s}[1][][0.5][0]{%s}\n',deblank(NAMES(jj,:)),deblank(TeXNAMES(jj,:)));
0078         end
0079         fprintf(fidTeX,'\\centering\n');
0080         fprintf(fidTeX,'\\includegraphics[scale=0.5]{%s_Priors%s}\n',M_.fname,int2str(plt));
0081         fprintf(fidTeX,'\\caption{Priors.}');
0082         fprintf(fidTeX,'\\label{Fig:Priors:%s}\n',int2str(plt));
0083         fprintf(fidTeX,'\\end{figure}\n');
0084     end
0085 end
0086 if TeX
0087     fprintf(fidTeX,' \n');
0088     fprintf(fidTeX,'%% End of TeX file.\n');
0089     fclose(fidTeX);
0090 end

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