1function plot_priors(bayestopt_,M_,estim_params_,options_) 2% function plot_priors 3% plots prior density 4% 5% INPUTS 6% o bayestopt_ [structure] 7% o M_ [structure] 8% o options_ [structure] 9% 10% OUTPUTS 11% None 12% 13% SPECIAL REQUIREMENTS 14% None 15 16% Copyright (C) 2004-2017 Dynare Team 17% 18% This file is part of Dynare. 19% 20% Dynare is free software: you can redistribute it and/or modify 21% it under the terms of the GNU General Public License as published by 22% the Free Software Foundation, either version 3 of the License, or 23% (at your option) any later version. 24% 25% Dynare is distributed in the hope that it will be useful, 26% but WITHOUT ANY WARRANTY; without even the implied warranty of 27% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 28% GNU General Public License for more details. 29% 30% You should have received a copy of the GNU General Public License 31% along with Dynare. If not, see <http://www.gnu.org/licenses/>. 32 33TeX = options_.TeX; 34 35figurename = 'Priors'; 36npar = length(bayestopt_.p1); 37[nbplt,nr,nc,lr,lc,nstar] = pltorg(npar); 38 39if ~exist([M_.fname '/graphs'],'dir') 40 mkdir(M_.fname,'graphs'); 41end 42if TeX && any(strcmp('eps',cellstr(options_.graph_format))) 43 fidTeX = fopen([M_.fname, '/graphs/' M_.fname '_Priors.tex'],'w'); 44 fprintf(fidTeX,'%% TeX eps-loader file generated by plot_priors.m (Dynare).\n'); 45 fprintf(fidTeX,['%% ' datestr(now,0) '\n']); 46 fprintf(fidTeX,' \n'); 47end 48for plt = 1:nbplt 49 hplt = dyn_figure(options_.nodisplay,'Name',figurename); 50 if TeX 51 TeXNAMES = []; 52 NAMES = []; 53 end 54 nstar0 = min(nstar,npar-(plt-1)*nstar); 55 for index=1:nstar0 56 names = []; 57 i = (plt-1)*nstar + index; 58 [x,f,abscissa,dens,binf,bsup] = draw_prior_density(i,bayestopt_); 59 [nam,texnam] = get_the_name(i,TeX,M_,estim_params_,options_); 60 if TeX 61 if index==1 62 TeXNAMES = texnam; 63 NAMES = nam; 64 else 65 TeXNAMES = char(TeXNAMES,texnam); 66 NAMES = char(NAMES,nam); 67 end 68 end 69 subplot(nr,nc,index) 70 hh = plot(x,f,'-k','linewidth',2); 71 set(hh,'color',[0.7 0.7 0.7]); 72 box on 73 title(nam,'Interpreter','none') 74 drawnow 75 end 76 dyn_saveas(hplt,[M_.fname, '/graphs/' M_.fname '_Priors' int2str(plt)],options_.nodisplay,options_.graph_format); 77 if TeX && any(strcmp('eps',cellstr(options_.graph_format))) 78 fprintf(fidTeX,'\\begin{figure}[H]\n'); 79 for jj = 1:nstar0 80 fprintf(fidTeX,'\\psfrag{%s}[1][][0.5][0]{%s}\n',deblank(NAMES(jj,:)),deblank(TeXNAMES(jj,:))); 81 end 82 fprintf(fidTeX,'\\centering\n'); 83 fprintf(fidTeX,'\\includegraphics[width=%2.2f\\textwidth]{%s_Priors%s}\n',options_.figures.textwidth*min(index/nc,1),[M_.fname, '/graphs/' M_.fname],int2str(plt)); 84 fprintf(fidTeX,'\\caption{Priors.}'); 85 fprintf(fidTeX,'\\label{Fig:Priors:%s}\n',int2str(plt)); 86 fprintf(fidTeX,'\\end{figure}\n'); 87 end 88end 89if TeX && any(strcmp('eps',cellstr(options_.graph_format))) 90 fprintf(fidTeX,' \n'); 91 fprintf(fidTeX,'%% End of TeX file.\n'); 92 fclose(fidTeX); 93end