2013-05-10 18:58:08 +02:00
function oo_= display_estimation_results_table ( xparam1,stdh,M_,options_,estim_params_,bayestopt_,oo_,pnames,table_title,field_name)
%function oo_=display_results_table(xparam1,stdh,M_,estim_params_,bayestopt_,oo_,pnames,table_title,field_name)
% Display estimation results on screen and write them to TeX-file
2017-05-16 15:10:20 +02:00
%
% INPUTS
2013-05-10 18:58:08 +02:00
% o xparam1 [double] (p*1) vector of estimate parameters.
% o stdh [double] (p*1) vector of estimate parameters.
2017-05-16 15:10:20 +02:00
% o M_ Matlab's structure describing the Model (initialized by dynare, see @ref{M_}).
2013-05-10 18:58:08 +02:00
% o estim_params_ Matlab's structure describing the estimated_parameters (initialized by dynare, see @ref{estim_params_}).
% o options_ Matlab's structure describing the options (initialized by dynare, see @ref{options_}).
% o bayestopt_ Matlab's structure describing the priors (initialized by dynare, see @ref{bayesopt_}).
% o oo_ Matlab's structure gathering the results (initialized by dynare, see @ref{oo_}).
2017-10-10 10:05:59 +02:00
% o pnames [string] Cell of strings storing the names for prior distributions
2017-05-16 15:10:20 +02:00
% o table_title [string] Title of the Table
2013-05-10 18:58:08 +02:00
% o field_name [string] String storing the name of the fields for oo_ where the parameters are stored
2017-05-16 15:10:20 +02:00
%
% OUTPUTS
2013-05-10 18:58:08 +02:00
% o oo_ Matlab's structure gathering the results
%
% SPECIAL REQUIREMENTS
% None.
2017-10-10 10:05:59 +02:00
% Copyright (C) 2014-2018 Dynare Team
2013-05-10 18:58:08 +02:00
%
% 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
2021-06-09 17:33:48 +02:00
% along with Dynare. If not, see <https://www.gnu.org/licenses/>.
2013-05-10 18:58:08 +02:00
nvx = estim_params_ . nvx ; % Variance of the structural innovations (number of parameters).
nvn = estim_params_ . nvn ; % Variance of the measurement innovations (number of parameters).
ncx = estim_params_ . ncx ; % Covariance of the structural innovations (number of parameters).
ncn = estim_params_ . ncn ; % Covariance of the measurement innovations (number of parameters).
np = estim_params_ . np ; % Number of deep parameters.
nx = nvx + nvn + ncx + ncn + np ; % Total number of parameters to be estimated.
2013-07-10 17:12:34 +02:00
skipline ( )
2013-05-10 18:58:08 +02:00
disp ( [ ' RESULTS FROM ' upper ( table_title ) ' ESTIMATION' ] )
LaTeXtitle = strrep ( table_title , ' ' , ' _' ) ;
tstath = abs ( xparam1 ) ./ stdh ;
2017-10-10 10:05:59 +02:00
header_width = row_header_width ( M_ , estim_params_ , bayestopt_ ) ;
2013-05-10 18:58:08 +02:00
if strcmp ( field_name , ' posterior' )
2017-10-10 10:05:59 +02:00
tit1 = sprintf ( ' %-*s %7s %8s %7s %4s %6s\n' , header_width - 2 , ' ' , ' prior mean' , ...
' mode' , ' s.d.' , ' prior' , ' pstdev' ) ;
2013-05-10 18:58:08 +02:00
else
2017-10-10 10:05:59 +02:00
tit1 = sprintf ( ' %-*s %10s %7s %6s\n' , header_width - 2 , ' ' , ' Estimate' , ' s.d.' , ' t-stat' ) ;
2013-05-10 18:58:08 +02:00
end
if np
ip = nvx + nvn + ncx + ncn + 1 ;
disp ( ' parameters' )
disp ( tit1 )
for i = 1 : np
name = bayestopt_ . name { ip } ;
if strcmp ( field_name , ' posterior' )
fprintf ( ' %-*s %7.3f %8.4f %7.4f %4s %6.4f \n' , ...
2017-05-16 15:10:20 +02:00
header_width , name , ...
bayestopt_ . p1 ( ip ) , xparam1 ( ip ) , stdh ( ip ) , ...
2017-10-10 10:05:59 +02:00
pnames { bayestopt_ . pshape ( ip ) + 1 } , ...
2017-05-16 15:10:20 +02:00
bayestopt_ . p2 ( ip ) ) ;
2013-05-10 18:58:08 +02:00
else
fprintf ( ' %-*s %8.4f %7.4f %7.4f \n' , ...
2017-10-10 10:05:59 +02:00
header_width , name , xparam1 ( ip ) , stdh ( ip ) , tstath ( ip ) ) ;
2013-05-10 18:58:08 +02:00
end
eval ( [ ' oo_.' field_name ' _mode.parameters.' name ' = xparam1(ip);' ] ) ;
2015-08-10 18:43:49 +02:00
eval ( [ ' oo_.' field_name ' _std_at_mode.parameters.' name ' = stdh(ip);' ] ) ;
2013-05-10 18:58:08 +02:00
ip = ip + 1 ;
end
2013-07-10 17:12:34 +02:00
skipline ( )
2013-05-10 18:58:08 +02:00
end
if nvx
ip = 1 ;
disp ( ' standard deviation of shocks' )
disp ( tit1 )
for i = 1 : nvx
k = estim_params_ . var_exo ( i , 1 ) ;
2017-10-10 10:05:59 +02:00
name = M_ . exo_names { k } ;
2013-05-10 18:58:08 +02:00
if strcmp ( field_name , ' posterior' )
fprintf ( ' %-*s %7.3f %8.4f %7.4f %4s %6.4f \n' , ...
2017-10-10 10:05:59 +02:00
header_width , name , bayestopt_ . p1 ( ip ) , xparam1 ( ip ) , ...
stdh ( ip ) , pnames { bayestopt_ . pshape ( ip ) + 1 } , ...
2017-05-16 15:10:20 +02:00
bayestopt_ . p2 ( ip ) ) ;
2013-05-10 18:58:08 +02:00
else
2017-10-10 10:05:59 +02:00
fprintf ( ' %-*s %8.4f %7.4f %7.4f \n' , header_width , name , xparam1 ( ip ) , stdh ( ip ) , tstath ( ip ) ) ;
2013-05-10 18:58:08 +02:00
end
M_ . Sigma_e ( k , k ) = xparam1 ( ip ) * xparam1 ( ip ) ;
eval ( [ ' oo_.' field_name ' _mode.shocks_std.' name ' = xparam1(ip);' ] ) ;
2015-08-10 18:43:49 +02:00
eval ( [ ' oo_.' field_name ' _std_at_mode.shocks_std.' name ' = stdh(ip);' ] ) ;
2013-05-10 18:58:08 +02:00
ip = ip + 1 ;
end
2013-07-10 17:12:34 +02:00
skipline ( )
2017-05-16 15:10:20 +02:00
end
if nvn
2013-05-10 18:58:08 +02:00
disp ( ' standard deviation of measurement errors' )
disp ( tit1 )
ip = nvx + 1 ;
for i = 1 : nvn
2013-09-09 10:27:59 +02:00
name = options_ . varobs { estim_params_ . nvn_observable_correspondence ( i , 1 ) } ;
2017-05-16 15:10:20 +02:00
if strcmp ( field_name , ' posterior' )
2013-05-10 18:58:08 +02:00
fprintf ( ' %-*s %7.3f %8.4f %7.4f %4s %6.4f \n' , ...
2017-10-10 10:05:59 +02:00
header_width , name , bayestopt_ . p1 ( ip ) , ...
xparam1 ( ip ) , stdh ( ip ) , ...
pnames { bayestopt_ . pshape ( ip ) + 1 } , ...
2017-05-16 15:10:20 +02:00
bayestopt_ . p2 ( ip ) ) ;
2013-05-10 18:58:08 +02:00
else
2017-10-10 10:05:59 +02:00
fprintf ( ' %-*s %8.4f %7.4f %7.4f \n' , header_width , name , xparam1 ( ip ) , ...
stdh ( ip ) , tstath ( ip ) )
2013-05-10 18:58:08 +02:00
end
eval ( [ ' oo_.' field_name ' _mode.measurement_errors_std.' name ' = xparam1(ip);' ] ) ;
2015-08-10 18:43:49 +02:00
eval ( [ ' oo_.' field_name ' _std_at_mode.measurement_errors_std.' name ' = stdh(ip);' ] ) ;
2013-05-10 18:58:08 +02:00
ip = ip + 1 ;
end
2013-07-10 17:12:34 +02:00
skipline ( )
2017-05-16 15:10:20 +02:00
end
2013-05-10 18:58:08 +02:00
if ncx
disp ( ' correlation of shocks' )
disp ( tit1 )
ip = nvx + nvn + 1 ;
for i = 1 : ncx
k1 = estim_params_ . corrx ( i , 1 ) ;
k2 = estim_params_ . corrx ( i , 2 ) ;
2017-10-10 10:05:59 +02:00
name = sprintf ( ' %s,%s' , M_ . exo_names { k1 } , M_ . exo_names { k2 } ) ;
NAME = sprintf ( ' %s_%s' , M_ . exo_names { k1 } , M_ . exo_names { k2 } ) ;
if strcmp ( field_name , ' posterior' )
2013-05-10 18:58:08 +02:00
fprintf ( ' %-*s %7.3f %8.4f %7.4f %4s %6.4f \n' , ...
2017-10-10 10:05:59 +02:00
header_width , name , bayestopt_ . p1 ( ip ) , xparam1 ( ip ) , stdh ( ip ) , ...
pnames { bayestopt_ . pshape ( ip ) + 1 } , bayestopt_ . p2 ( ip ) ) ;
2013-05-10 18:58:08 +02:00
else
2017-10-10 10:05:59 +02:00
fprintf ( ' %-*s %8.4f %7.4f %7.4f \n' , header_width , name , xparam1 ( ip ) , ...
stdh ( ip ) , tstath ( ip ) ) ;
2013-05-10 18:58:08 +02:00
end
M_ . Sigma_e ( k1 , k2 ) = xparam1 ( ip ) * sqrt ( M_ . Sigma_e ( k1 , k1 ) * M_ . Sigma_e ( k2 , k2 ) ) ;
M_ . Sigma_e ( k2 , k1 ) = M_ . Sigma_e ( k1 , k2 ) ;
eval ( [ ' oo_.' field_name ' _mode.shocks_corr.' NAME ' = xparam1(ip);' ] ) ;
2015-08-10 18:43:49 +02:00
eval ( [ ' oo_.' field_name ' _std_at_mode.shocks_corr.' NAME ' = stdh(ip);' ] ) ;
2013-05-10 18:58:08 +02:00
ip = ip + 1 ;
end
2013-07-10 17:12:34 +02:00
skipline ( )
2013-05-10 18:58:08 +02:00
end
if ncn
disp ( ' correlation of measurement errors' )
disp ( tit1 )
ip = nvx + nvn + ncx + 1 ;
for i = 1 : ncn
k1 = estim_params_ . corrn ( i , 1 ) ;
k2 = estim_params_ . corrn ( i , 2 ) ;
2017-10-10 10:05:59 +02:00
name = sprintf ( ' %s,%s' , M_ . endo_names { k1 } , M_ . endo_names { k2 } ) ;
NAME = sprintf ( ' %s_%s' , M_ . endo_names { k1 } , M_ . endo_names { k2 } ) ;
2017-05-16 15:10:20 +02:00
if strcmp ( field_name , ' posterior' )
2013-05-10 18:58:08 +02:00
fprintf ( ' %-*s %7.3f %8.4f %7.4f %4s %6.4f \n' , ...
2017-10-10 10:05:59 +02:00
header_width , name , bayestopt_ . p1 ( ip ) , xparam1 ( ip ) , stdh ( ip ) , ...
pnames { bayestopt_ . pshape ( ip ) + 1 } , bayestopt_ . p2 ( ip ) ) ;
2013-05-10 18:58:08 +02:00
else
2017-10-10 10:05:59 +02:00
fprintf ( ' %-*s %8.4f %7.4f %7.4f \n' , header_width , name , xparam1 ( ip ) , ...
stdh ( ip ) , tstath ( ip ) ) ;
2013-05-10 18:58:08 +02:00
end
eval ( [ ' oo_.' field_name ' _mode.measurement_errors_corr.' NAME ' = xparam1(ip);' ] ) ;
2015-08-10 18:43:49 +02:00
eval ( [ ' oo_.' field_name ' _std_at_mode.measurement_errors_corr.' NAME ' = stdh(ip);' ] ) ;
2013-05-10 18:58:08 +02:00
ip = ip + 1 ;
end
2013-07-10 17:12:34 +02:00
skipline ( )
2013-05-10 18:58:08 +02:00
end
2017-10-10 10:05:59 +02:00
2013-11-06 08:26:22 +01:00
if any ( xparam1 ( 1 : nvx + nvn ) < 0 )
warning ( ' Some estimated standard deviations are negative. Dynare internally works with variances so that the sign does not matter. Nevertheless, it is recommended to impose either prior restrictions (Bayesian Estimation) or a lower bound (ML) to assure positive values.' )
end
2013-05-10 18:58:08 +02:00
OutputDirectoryName = CheckPath ( ' Output' , M_ . dname ) ;
if any ( bayestopt_ . pshape > 0 ) && options_ . TeX %% Bayesian estimation (posterior mode) Latex output
if np
2016-06-14 09:48:35 +02:00
filename = [ OutputDirectoryName ' /' M_ . fname ' _Posterior_Mode_1.tex' ] ;
2013-05-10 18:58:08 +02:00
fidTeX = fopen ( filename , ' w' ) ;
2015-12-13 16:42:52 +01:00
TeXBegin_Bayesian ( fidTeX , 1 , ' parameters' )
2013-05-10 18:58:08 +02:00
ip = nvx + nvn + ncx + ncn + 1 ;
for i = 1 : np
fprintf ( fidTeX , ' $%s$ & %s & %7.3f & %6.4f & %8.4f & %7.4f \\\\ \n' , ...
2017-10-10 10:05:59 +02:00
M_ . param_names_tex { estim_params_ . param_vals ( i , 1 ) } , ...
pnames { bayestopt_ . pshape ( ip ) + 1 } , ...
bayestopt_ . p1 ( ip ) , ...
bayestopt_ . p2 ( ip ) , ...
xparam1 ( ip ) , ...
2013-05-10 18:58:08 +02:00
stdh ( ip ) ) ;
ip = ip + 1 ;
end
2015-12-13 16:42:52 +01:00
TeXEnd ( fidTeX )
2013-05-10 18:58:08 +02:00
end
if nvx
2016-06-14 09:48:35 +02:00
TeXfile = [ OutputDirectoryName ' /' M_ . fname ' _Posterior_Mode_2.tex' ] ;
2013-05-10 18:58:08 +02:00
fidTeX = fopen ( TeXfile , ' w' ) ;
2015-12-13 16:42:52 +01:00
TeXBegin_Bayesian ( fidTeX , 2 , ' standard deviation of structural shocks' )
2013-05-10 18:58:08 +02:00
ip = 1 ;
for i = 1 : nvx
k = estim_params_ . var_exo ( i , 1 ) ;
fprintf ( fidTeX , [ ' $%s$ & %4s & %7.3f & %6.4f & %8.4f & %7.4f \\\\ \n' ] , ...
2017-10-10 10:05:59 +02:00
M_ . exo_names_tex { k } , ...
pnames { bayestopt_ . pshape ( ip ) + 1 } , ...
2013-05-10 18:58:08 +02:00
bayestopt_ . p1 ( ip ) , ...
bayestopt_ . p2 ( ip ) , ...
xparam1 ( ip ) , ...
stdh ( ip ) ) ;
ip = ip + 1 ;
end
2015-12-13 16:42:52 +01:00
TeXEnd ( fidTeX )
2013-05-10 18:58:08 +02:00
end
if nvn
2016-06-14 09:48:35 +02:00
TeXfile = [ OutputDirectoryName ' /' M_ . fname ' _Posterior_Mode_3.tex' ] ;
2013-05-10 18:58:08 +02:00
fidTeX = fopen ( TeXfile , ' w' ) ;
2015-12-13 16:42:52 +01:00
TeXBegin_Bayesian ( fidTeX , 3 , ' standard deviation of measurement errors' )
2013-05-10 18:58:08 +02:00
ip = nvx + 1 ;
for i = 1 : nvn
2017-10-10 10:05:59 +02:00
idx = strmatch ( options_ . varobs { estim_params_ . nvn_observable_correspondence ( i , 1 ) } , M_ . endo_names ) ;
2013-05-10 18:58:08 +02:00
fprintf ( fidTeX , ' $%s$ & %4s & %7.3f & %6.4f & %8.4f & %7.4f \\\\ \n' , ...
2017-10-10 10:05:59 +02:00
M_ . endo_names_tex { idx } , ...
pnames { bayestopt_ . pshape ( ip ) + 1 } , ...
2013-05-10 18:58:08 +02:00
bayestopt_ . p1 ( ip ) , ...
bayestopt_ . p2 ( ip ) , ...
xparam1 ( ip ) , ...
stdh ( ip ) ) ;
ip = ip + 1 ;
end
2015-12-13 16:42:52 +01:00
TeXEnd ( fidTeX )
2013-05-10 18:58:08 +02:00
end
if ncx
2016-06-14 09:48:35 +02:00
TeXfile = [ OutputDirectoryName ' /' M_ . fname ' _Posterior_Mode_4.tex' ] ;
2013-05-10 18:58:08 +02:00
fidTeX = fopen ( TeXfile , ' w' ) ;
2015-12-13 16:42:52 +01:00
TeXBegin_Bayesian ( fidTeX , 4 , ' correlation of structural shocks' )
2013-05-10 18:58:08 +02:00
ip = nvx + nvn + 1 ;
for i = 1 : ncx
k1 = estim_params_ . corrx ( i , 1 ) ;
k2 = estim_params_ . corrx ( i , 2 ) ;
fprintf ( fidTeX , [ ' $%s$ & %s & %7.3f & %6.4f & %8.4f & %7.4f \\\\ \n' ] , ...
2017-10-10 10:05:59 +02:00
[ M_ . exo_names_tex { k1 } ' ,' M_ . exo_names_tex { k2 } ] , ...
pnames { bayestopt_ . pshape ( ip ) + 1 } , ...
2013-05-10 18:58:08 +02:00
bayestopt_ . p1 ( ip ) , ...
bayestopt_ . p2 ( ip ) , ...
xparam1 ( ip ) , ...
stdh ( ip ) ) ;
ip = ip + 1 ;
end
2015-12-13 16:42:52 +01:00
TeXEnd ( fidTeX )
2013-05-10 18:58:08 +02:00
end
if ncn
2016-06-14 09:48:35 +02:00
TeXfile = [ OutputDirectoryName ' /' M_ . fname ' _Posterior_Mode_5.tex' ] ;
2013-05-10 18:58:08 +02:00
fidTeX = fopen ( TeXfile , ' w' ) ;
2015-12-13 16:42:52 +01:00
TeXBegin_Bayesian ( fidTeX , 5 , ' correlation of measurement errors' )
2013-05-10 18:58:08 +02:00
ip = nvx + nvn + ncx + 1 ;
for i = 1 : ncn
k1 = estim_params_ . corrn ( i , 1 ) ;
k2 = estim_params_ . corrn ( i , 2 ) ;
fprintf ( fidTeX , ' $%s$ & %s & %7.3f & %6.4f & %8.4f & %7.4f \\\\ \n' , ...
2017-10-10 10:05:59 +02:00
[ M_ . endo_names_tex { k1 } ' ,' M_ . endo_names_tex { k2 } ] , ...
pnames { bayestopt_ . pshape ( ip ) + 1 } , ...
2013-05-10 18:58:08 +02:00
bayestopt_ . p1 ( ip ) , ...
bayestopt_ . p2 ( ip ) , ...
xparam1 ( ip ) , ...
stdh ( ip ) ) ;
ip = ip + 1 ;
end
2015-12-13 16:42:52 +01:00
TeXEnd ( fidTeX )
2013-05-10 18:58:08 +02:00
end
elseif all ( bayestopt_ . pshape == 0 ) && options_ . TeX %% MLE and GMM Latex output
2017-05-16 15:10:20 +02:00
if np
2016-06-14 09:48:35 +02:00
filename = [ OutputDirectoryName ' /' M_ . fname ' _' LaTeXtitle ' _Mode_1.tex' ] ;
2017-10-10 10:05:59 +02:00
fidTeX = fopen ( filename , ' w' ) ;
TeXBegin_ML ( fidTeX , 1 , ' parameters' , table_title , LaTeXtitle )
2013-05-10 18:58:08 +02:00
ip = nvx + nvn + ncx + ncn + 1 ;
for i = 1 : np
fprintf ( fidTeX , ' $%s$ & %8.4f & %7.4f & %7.4f\\\\ \n' , ...
2017-10-10 10:05:59 +02:00
M_ . param_names_tex { estim_params_ . param_vals ( i , 1 ) } , ...
xparam1 ( ip ) , ...
stdh ( ip ) , ...
2017-05-16 15:10:20 +02:00
tstath ( ip ) ) ;
2013-05-10 18:58:08 +02:00
ip = ip + 1 ;
end
2015-12-13 16:42:52 +01:00
TeXEnd ( fidTeX )
2013-05-10 18:58:08 +02:00
end
if nvx
2016-06-14 09:48:35 +02:00
filename = [ OutputDirectoryName ' /' M_ . fname ' _' LaTeXtitle ' _Mode_2.tex' ] ;
2017-10-10 10:05:59 +02:00
fidTeX = fopen ( filename , ' w' ) ;
TeXBegin_ML ( fidTeX , 2 , ' standard deviation of structural shocks' , table_title , LaTeXtitle )
2013-05-10 18:58:08 +02:00
ip = 1 ;
for i = 1 : nvx
k = estim_params_ . var_exo ( i , 1 ) ;
2017-10-10 10:05:59 +02:00
fprintf ( fidTeX , [ ' $%s$ & %8.4f & %7.4f & %7.4f\\\\ \n' ] , ...
M_ . exo_names_tex { k } , ...
2013-05-10 18:58:08 +02:00
xparam1 ( ip ) , ...
2017-10-10 10:05:59 +02:00
stdh ( ip ) , ...
2013-05-10 18:58:08 +02:00
tstath ( ip ) ) ;
ip = ip + 1 ;
end
2015-12-13 16:42:52 +01:00
TeXEnd ( fidTeX )
2013-05-10 18:58:08 +02:00
end
if nvn
2016-06-14 09:48:35 +02:00
filename = [ OutputDirectoryName ' /' M_ . fname ' _' LaTeXtitle ' _Mode_3.tex' ] ;
2017-10-10 10:05:59 +02:00
fidTeX = fopen ( filename , ' w' ) ;
TeXBegin_ML ( fidTeX , 3 , ' standard deviation of measurement errors' , table_title , LaTeXtitle )
2013-05-10 18:58:08 +02:00
ip = nvx + 1 ;
for i = 1 : nvn
2017-10-10 10:05:59 +02:00
idx = strmatch ( options_ . varobs { estim_params_ . nvn_observable_correspondence ( i , 1 ) } , M_ . endo_names ) ;
fprintf ( fidTeX , ' $%s$ & %8.4f & %7.4f & %7.4f \\\\ \n' , ...
M_ . endo_names_tex { idx } , ...
xparam1 ( ip ) , ...
stdh ( ip ) , ...
2013-05-10 18:58:08 +02:00
tstath ( ip ) ) ;
ip = ip + 1 ;
end
2015-12-13 16:42:52 +01:00
TeXEnd ( fidTeX )
2013-05-10 18:58:08 +02:00
end
if ncx
2016-06-14 09:48:35 +02:00
filename = [ OutputDirectoryName ' /' M_ . fname ' _' LaTeXtitle ' _Mode_4.tex' ] ;
2017-10-10 10:05:59 +02:00
fidTeX = fopen ( filename , ' w' ) ;
TeXBegin_ML ( fidTeX , 4 , ' correlation of structural shocks' , table_title , LaTeXtitle )
2013-05-10 18:58:08 +02:00
ip = nvx + nvn + 1 ;
for i = 1 : ncx
k1 = estim_params_ . corrx ( i , 1 ) ;
k2 = estim_params_ . corrx ( i , 2 ) ;
2017-10-10 10:05:59 +02:00
fprintf ( fidTeX , [ ' $%s$ & %8.4f & %7.4f & %7.4f \\\\ \n' ] , ...
[ M_ . exo_names_tex { k1 } ' ,' M_ . exo_names_tex { k2 } ] , ...
2013-05-10 18:58:08 +02:00
xparam1 ( ip ) , ...
2017-10-10 10:05:59 +02:00
stdh ( ip ) , ...
2013-05-10 18:58:08 +02:00
tstath ( ip ) ) ;
ip = ip + 1 ;
end
2015-12-13 16:42:52 +01:00
TeXEnd ( fidTeX )
2013-05-10 18:58:08 +02:00
end
if ncn
2016-06-14 09:48:35 +02:00
filename = [ OutputDirectoryName ' /' M_ . fname ' _' LaTeXtitle ' _Mode_5.tex' ] ;
2017-10-10 10:05:59 +02:00
fidTeX = fopen ( filename , ' w' ) ;
TeXBegin_ML ( fidTeX , 5 , ' correlation of measurement errors' , table_title , LaTeXtitle )
2013-05-10 18:58:08 +02:00
ip = nvx + nvn + ncx + 1 ;
for i = 1 : ncn
k1 = estim_params_ . corrn ( i , 1 ) ;
k2 = estim_params_ . corrn ( i , 2 ) ;
2017-10-10 10:05:59 +02:00
fprintf ( fidTeX , ' $%s$ & %8.4f & %7.4f & %7.4f \\\\ \n' , ...
[ M_ . endo_names_tex { k1 } ' ,' M_ . endo_names_tex { k2 } ] , ...
2013-05-10 18:58:08 +02:00
xparam1 ( ip ) , ...
2017-10-10 10:05:59 +02:00
stdh ( ip ) , ...
2013-05-10 18:58:08 +02:00
tstath ( ip ) ) ;
ip = ip + 1 ;
end
2017-05-16 15:10:20 +02:00
TeXEnd ( fidTeX )
2016-06-14 15:50:48 +02:00
end
2013-11-06 08:26:22 +01:00
end
2015-12-13 16:42:52 +01:00
%% subfunctions:
%
2017-10-10 10:05:59 +02:00
function TeXBegin_Bayesian ( fid, fnum, title)
2017-05-16 15:10:20 +02:00
fprintf ( fid , ' %% TeX-table generated by dynare_estimation (Dynare).\n' ) ;
fprintf ( fid , [ ' %% RESULTS FROM POSTERIOR MAXIMIZATION (' title ' )\n' ] ) ;
fprintf ( fid , [ ' %% ' datestr ( now , 0 ) ] ) ;
fprintf ( fid , ' \n' ) ;
fprintf ( fid , ' \n' ) ;
fprintf ( fid , ' \\begin{center}\n' ) ;
fprintf ( fid , ' \\begin{longtable}{llcccc} \n' ) ;
fprintf ( fid , [ ' \\caption{Results from posterior maximization (' title ' )}\\\\\n ' ] ) ;
fprintf ( fid , [ ' \\label{Table:Posterior:' int2str ( fnum ) ' }\\\\\n' ] ) ;
fprintf ( fid , ' \\toprule \n' ) ;
fprintf ( fid , ' & \\multicolumn{3}{c}{Prior} & \\multicolumn{2}{c}{Posterior} \\\\\n' ) ;
fprintf ( fid , ' \\cmidrule(r{.75em}){2-4} \\cmidrule(r{.75em}){5-6}\n' ) ;
fprintf ( fid , ' & Dist. & Mean & Stdev & Mode & Stdev \\\\ \n' ) ;
fprintf ( fid , ' \\midrule \\endfirsthead \n' ) ;
fprintf ( fid , ' \\caption{(continued)}\\\\\n ' ) ;
fprintf ( fid , ' \\bottomrule \n' ) ;
fprintf ( fid , ' & \\multicolumn{3}{c}{Prior} & \\multicolumn{2}{c}{Posterior} \\\\\n' ) ;
fprintf ( fid , ' \\cmidrule(r{.75em}){2-4} \\cmidrule(r{.75em}){5-6}\n' ) ;
fprintf ( fid , ' & Dist. & Mean & Stdev & Mode & Stdev \\\\ \n' ) ;
fprintf ( fid , ' \\midrule \\endhead \n' ) ;
fprintf ( fid , ' \\bottomrule \\multicolumn{6}{r}{(Continued on next page)}\\endfoot \n' ) ;
fprintf ( fid , ' \\bottomrule\\endlastfoot \n' ) ;
2017-10-10 10:05:59 +02:00
function TeXBegin_ML ( fid, fnum, title, table_title, LaTeXtitle)
2017-05-16 15:10:20 +02:00
fprintf ( fid , ' %% TeX-table generated by dynare_estimation (Dynare).\n' ) ;
fprintf ( fid , [ ' %% RESULTS FROM ' table_title ' MAXIMIZATION (' title ' )\n' ] ) ;
fprintf ( fid , [ ' %% ' datestr ( now , 0 ) ] ) ;
fprintf ( fid , ' \n' ) ;
fprintf ( fid , ' \n' ) ;
fprintf ( fid , ' \\begin{center}\n' ) ;
fprintf ( fid , ' \\begin{longtable}{llcc} \n' ) ;
fprintf ( fid , [ ' \\caption{Results from ' table_title ' maximization (' title ' )}\\\\\n ' ] ) ;
fprintf ( fid , [ ' \\label{Table:' LaTeXtitle ' :' int2str ( fnum ) ' }\\\\\n' ] ) ;
fprintf ( fid , ' \\toprule \n' ) ;
fprintf ( fid , ' & Mode & s.d. & t-stat\\\\ \n' ) ;
fprintf ( fid , ' \\midrule \\endfirsthead \n' ) ;
fprintf ( fid , ' \\caption{(continued)}\\\\\n ' ) ;
fprintf ( fid , ' \\toprule \n' ) ;
fprintf ( fid , ' & Mode & s.d. & t-stat\\\\ \n' ) ;
fprintf ( fid , ' \\midrule \\endhead \n' ) ;
fprintf ( fid , ' \\bottomrule \\multicolumn{4}{r}{(Continued on next page)} \\endfoot \n' ) ;
fprintf ( fid , ' \\bottomrule \\endlastfoot \n' ) ;
2015-12-13 16:42:52 +01:00
function TeXEnd ( fid)
2017-05-16 15:10:20 +02:00
fprintf ( fid , ' \\end{longtable}\n ' ) ;
2015-12-13 16:42:52 +01:00
fprintf ( fid , ' \\end{center}\n' ) ;
fprintf ( fid , ' %% End of TeX file.\n' ) ;
fclose ( fid ) ;