Commit e2d98b9f authored by Stéphane Adjemian's avatar Stéphane Adjemian
Browse files

+ Removed globals from get_the_name routine. Added texinfo header.

parent 9b3ca2b6
......@@ -138,7 +138,7 @@ for i = 1:pages
boxplot = 1;
for j = 1:3 % Loop over parameters
k = k+1;
[nam,namtex] = get_the_name(k,TeX);
[nam,namtex] = get_the_name(k,TeX,M_,estim_params_,options_);
for crit = 1:3% Loop over criteria
if crit == 1
plt1 = UDIAG(:,1,k);
......@@ -213,7 +213,7 @@ if reste
boxplot = 1;
for j = 1:reste
k = k+1;
[nam,namtex] = get_the_name(k,TeX);
[nam,namtex] = get_the_name(k,TeX,M_,estim_params_,options_);
for crit = 1:3
if crit == 1
plt1 = UDIAG(:,1,k);
......
......@@ -69,7 +69,7 @@ for i=1:npar
hfig = figure('Name',figurename);
end
end
[nam,texnam] = get_the_name(i,TeX);
[nam,texnam] = get_the_name(i,TeX,M_,estim_params_,options_);
if subplotnum == 1
NAMES = nam;
if TeX
......
......@@ -66,7 +66,7 @@ if size(M_.param_names,1)==size(M_.param_names_tex,1)% All the parameters have a
PriorIntervals = prior_bounds(bayestopt_) ;
options_.prior_trunc = prior_trunc_backup ;
for i=1:size(bayestopt_.name,1)
[tmp,TexName] = get_the_name(i,1);
[tmp,TexName] = get_the_name(i,1,M_,estim_params_,options_);
PriorShape = PriorNames{ bayestopt_.pshape(i) };
PriorMean = bayestopt_.p1(i);
PriorStandardDeviation = bayestopt_.p2(i);
......@@ -157,7 +157,7 @@ if info==2% Prior optimization.
disp('------------------')
disp(' ')
for i = 1:length(xparams)
disp(['deep parameter ' int2str(i) ': ' get_the_name(i,0) '.'])
disp(['deep parameter ' int2str(i) ': ' get_the_name(i,0,M_,estim_params_,options_) '.'])
disp([' Initial condition ....... ' num2str(xinit(i)) '.'])
disp([' Prior mode .............. ' num2str(bayestopt_.p5(i)) '.'])
disp([' Optimized prior mode .... ' num2str(xparams(i)) '.'])
......
function [nam,texnam] = get_the_name(k,TeX)
function [nam,texnam] = get_the_name(k,TeX,M_,estim_params_,options_)
% function [nam,texnam] = get_the_name(k,TeX)
% get the name of parameters
%
% INPUTS
% k: parameter number
% Tex=1: tex variable name
% Tex=0: variable name (in the mod-file)
%
% OUTPUTS
% nam: variable name
% texnam: variable tex name
%
% SPECIAL REQUIREMENTS
% none
%@info:
%! @deftypefn {Function File} {[@var{nam},@var{texnam}] =} get_the_name (@var{k},@var{TeX},@var{M_},@var{estim_params_},@var{options_})
%! @anchor{get_the_name}
%! @sp 1
%! Returns the name of the estimated parameter number @var{k}, following the internal ordering of the estimated parameters.
%! @sp 2
%! @strong{Inputs}
%! @sp 1
%! @table @ @var
%! @item k
%! Integer scalar, parameter number.
%! @item TeX
%! Integer scalar, if @var{TeX}==0 then @var{texnam} is not returned (empty matrix).
%! @item M_
%! Matlab's structure describing the model (initialized by @code{dynare}).
%! @item estim_params_
%! Matlab's structure describing the estimated parameters (initialized by @code{dynare}).
%! @item options_
%! Matlab's structure describing the options (initialized by @code{dynare}).
%! @end table
%! @sp 2
%! @strong{Outputs}
%! @sp 1
%! @table @ @var
%! @item nam
%! String, internal name of the variable
%! @item texnam
%! String, TeX name of the same variable (if defined in the mod file).
%! @end table
%! @sp 2
%! @strong{This function is called by:}
%! @sp 1
%! @ref{get_prior_info}, @ref{McMCDiagnostics}, @ref{mode_check}, @ref{PlotPosteriorDistributions}, @ref{plot_priors}
%! @sp 2
%! @strong{This function calls:}
%! @sp 1
%! None.
%! @end deftypefn
%@eod:
% Copyright (C) 2004-2010 Dynare Team
% Copyright (C) 2004-2011 Dynare Team
%
% This file is part of Dynare.
%
......@@ -32,8 +57,6 @@ function [nam,texnam] = get_the_name(k,TeX)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
global M_ estim_params_ options_
nam = [];
texnam = [];
......@@ -77,15 +100,10 @@ elseif k <= (nvx+nvn+ncx+ncn)
texnam =['$ CC_{' tname '} $'];
end
else
jj = k - (nvx+nvn+ncx+ncn);
jj = k - (nvx+nvn+ncx+ncn);
jj1 = estim_params_.param_vals(jj,1);
nam = deblank(M_.param_names(jj1,:));
if TeX
texnam = ['$ ' deblank(M_.param_names_tex(jj1,:)) ' $'];
end
end
% SA 07-15-2004 Added TeX names.
% SA 12-02-2004 Changed non-TeX names format.
% SA 01-11-2005 v3TOv4
\ No newline at end of file
end
end
\ No newline at end of file
......@@ -35,7 +35,7 @@ function mode_check(x,fval,hessian,gend,data,lb,ub,data_index,number_of_observat
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
global bayestopt_ M_ options_
global bayestopt_ M_ options_ estim_params_
TeX = options_.TeX;
if ~isempty(hessian);
......@@ -77,7 +77,7 @@ for plt = 1:nbplt,
for k=1:min(nstar,length(x)-(plt-1)*nstar)
subplot(nr,nc,k)
kk = (plt-1)*nstar+k;
[name,texname] = get_the_name(kk,TeX);
[name,texname] = get_the_name(kk,TeX,M_,estim_params_,options_);
if TeX
if isempty(NAMES)
NAMES = name;
......
function plot_priors(bayestopt_,M_,options_)
function plot_priors(bayestopt_,M_,estim_params_,options_)
% function plot_priors
% plots prior density
%
......@@ -6,10 +6,10 @@ function plot_priors(bayestopt_,M_,options_)
% o bayestopt_ [structure]
% o M_ [structure]
% o options_ [structure]
%
%
% OUTPUTS
% None
%
%
% SPECIAL REQUIREMENTS
% None
......@@ -46,11 +46,11 @@ if nbplt == 1
h1 = figure('Name',figurename);
if TeX
TeXNAMES = [];
NAMES = [];
end
NAMES = [];
end
for i=1:npar
[x,f,abscissa,dens,binf,bsup] = draw_prior_density(i,bayestopt_);
[nam,texnam] = get_the_name(i,TeX);
[nam,texnam] = get_the_name(i,TeX,M_,estim_params_,options_);
if TeX
if i==1
TeXNAMES = texnam;
......@@ -59,7 +59,7 @@ if nbplt == 1
TeXNAMES = char(TeXNAMES,texnam);
NAMES = char(NAMES,nam);
end
end
end
subplot(nr,nc,i)
hh = plot(x,f,'-k','linewidth',2);
set(hh,'color',[0.7 0.7 0.7]);
......@@ -77,7 +77,7 @@ if nbplt == 1
fprintf(fidTeX,'\\begin{figure}[H]\n');
for jj = 1:npar
fprintf(fidTeX,'\\psfrag{%s}[1][][0.5][0]{%s}\n',deblank(NAMES(jj,:)),deblank(TeXNAMES(jj,:)));
end
end
fprintf(fidTeX,'\\centering\n');
fprintf(fidTeX,'\\includegraphics[scale=0.5]{%s_Priors%s}\n',M_.fname,int2str(1));
fprintf(fidTeX,'\\caption{Priors.}');
......@@ -92,13 +92,13 @@ else
hplt = figure('Name',figurename);
if TeX
TeXNAMES = [];
NAMES = [];
end
NAMES = [];
end
for index=1:nstar
names = [];
i = (plt-1)*nstar + index;
[nam,texnam] = get_the_name(i,TeX);
[x,f,abscissa,dens,binf,bsup] = draw_prior_density(i,bayestopt_);
[nam,texnam] = get_the_name(i,TeX,M_,estim_params_,options_);
[x,f,abscissa,dens,binf,bsup] = draw_prior_density(i,bayestopt_);
if TeX
if index==1
TeXNAMES = texnam;
......@@ -125,24 +125,24 @@ else
fprintf(fidTeX,'\\begin{figure}[H]\n');
for jj = 1:nstar
fprintf(fidTeX,'\\psfrag{%s}[1][][0.5][0]{%s}\n',deblank(NAMES(jj,:)),deblank(TeXNAMES(jj,:)));
end
end
fprintf(fidTeX,'\\centering\n');
fprintf(fidTeX,'\\includegraphics[scale=0.5]{%s_Priors%s}\n',M_.fname,int2str(plt));
fprintf(fidTeX,'\\caption{Priors.}');
fprintf(fidTeX,'\\label{Fig:Priors:%s}\n',int2str(plt));
fprintf(fidTeX,'\\end{figure}\n');
fprintf(fidTeX,' \n');
end
end
end % plt = 1:nbplt-1
hplt = figure('Name',figurename);
if TeX
TeXNAMES = [];
NAMES = [];
end
NAMES = [];
end
for index=1:npar-(nbplt-1)*nstar
i = (nbplt-1)*nstar + index;
[x,f,abscissa,dens,binf,bsup] = draw_prior_density(i,bayestopt_);
[nam,texnam] = get_the_name(i,TeX);
[nam,texnam] = get_the_name(i,TeX,M_,estim_params_,options_);
if TeX
if index==1
TeXNAMES = texnam;
......@@ -151,12 +151,12 @@ else
TeXNAMES = char(TeXNAMES,texnam);
NAMES = char(NAMES,nam);
end
end
end
if lr
subplot(lc,lr,index);
else
subplot(nr,nc,index);
end
end
hh = plot(x,f,'-k','linewidth',2);
set(hh,'color',[0.7 0.7 0.7]);
box on
......@@ -173,7 +173,7 @@ else
fprintf(fidTeX,'\\begin{figure}[H]\n');
for jj = 1:npar-(nbplt-1)*nstar
fprintf(fidTeX,'\\psfrag{%s}[1][][0.5][0]{%s}\n',deblank(NAMES(jj,:)),deblank(TeXNAMES(jj,:)));
end
end
fprintf(fidTeX,'\\centering\n');
fprintf(fidTeX,'\\includegraphics[scale=0.5]{%s_Priors%s}\n',M_.fname,int2str(nbplt));
fprintf(fidTeX,'\\caption{Priors.}');
......@@ -183,6 +183,4 @@ else
fprintf(fidTeX,'%% End of TeX file.\n');
fclose(fidTeX);
end
end
% SA 01-11-2005 v3TOv4
end
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment