多列中心值表

多列中心值表

您好,请问有什么建议可以将最后一行(R^2)的值居中放在我的表格和输出中

特克斯:

  \documentclass[12pt,notitlepage]{article}
  \usepackage[table]{xcolor}
  \usepackage{amssymb}
 \usepackage{amsmath}
\usepackage{mathbbol}
\usepackage{bbm}
\usepackage{amsthm}
 \usepackage{pdfpages}
\usepackage{graphicx,color,psfrag}
\usepackage{epstopdf}
\usepackage{pdflscape}
\usepackage{tabularx}
\usepackage{longtable}
\usepackage{breakurl}
\usepackage{enumitem}
% caption fonts
 \usepackage[font={large,bf}]{caption} 

 \usepackage{setspace}
 \usepackage{longtable}
 \usepackage{threeparttable}  
 \usepackage{tabulary}
 \usepackage{booktabs}
 \usepackage{float}
 \usepackage{caption}
 \usepackage{subcaption}
 \usepackage{rotating}
 \usepackage{array,multirow}

   \begin{document}

 \begin{landscape}
   \begin{table}[!ht]
  \begin{center}
    \caption{Predictive regression estimation results, 1926:07-2021:02}
    \label{tab:table_segregation_occ_stats}
\resizebox{1.34\textwidth}{!}{
   \begin{tabular}{lcccccccccccc}
   \toprule
  \toprule
         & \multicolumn{ 4}{c}{\textbf{LASSO}} & \multicolumn{4}{c}{\textbf{OLS}} & \multicolumn{4}{c}{\textbf{ OLS Post-LASSO
                                       }}  \\
                               \cmidrule(lr){2-5}
                              \cmidrule(lr){6-9}
                    \cmidrule(lr){10-13}
                 & \multicolumn{ 2}{c}{NoDur} & \multicolumn{ 2}{c}{Durbl} & \multicolumn{ 2}{c}{NoDur} & \multicolumn{ 2}{c}{Durbl} & \multicolumn{ 2}{c}{NoDur} & \multicolumn{ 2}{c}{Durbl} \\
        \cmidrule(lr){2-3}
          \cmidrule(lr){4-5}
                  \cmidrule(lr){6-7}
                    \cmidrule(lr){8-9}
                    \cmidrule(lr){10-11}
                      \cmidrule(lr){12-13}
             &\multicolumn{1}{c}{Coef.}&\multicolumn{1}{c}{P-value}&\multicolumn{1}{c}{Coef.}&\multicolumn{1}{c}{P-value}&\multicolumn{1}{c}{Coef.}&\multicolumn{1}{c}{P-value}&\multicolumn{1}{c}{Coef.}&\multicolumn{1}{c}{P-value}&\multicolumn{1}{c}{Coef.}&\multicolumn{1}{c}{P-value}&\multicolumn{1}{c}{Coef.}&\multicolumn{1}{c}{P-value}\\
            \cmidrule{2-13}
                              \rule{0pt}{3ex}\textit{Consumer Nondurables  }   &-& -& -0,086& 0,51& -0,004& 0,966&-0,146& 0.27&-& -&-0,14&0,26\\

        \rule{0pt}{3ex}\textit{Consumer Durables  }     &-&-&-0,055&0,41&-0,005&0,920&-0,07&0,29&-&-&-0,087&0,19\\
      \rule{0pt}{3ex}\textit{Manufacturing    }       &-&-& -& -&-0,014&0.89&-0,070& 0.65&-&-&-&-\\
         \rule{0pt}{3ex}\textit{Energy  }                &-0,094&0,01&-0,120&0.04&-0,112&0,009&-0,13&0.03&-0,12&0,001&-0,13&0,023\\
        \rule{0pt}{3ex}\textit{Chemicals and Allied Products  }&-&-&-0,053&0.62&-0,066&0,433&-0,040&0.73&-&-&-0,05&0,61\\

         \rule{0pt}{3ex}\textit{Business Equipment   }       &-&-&0,081& 0,16&0,009&0.83&0,10&0.14&-&-&0,097&0,098\\
       \rule{0pt}{3ex}\textit{Telecom  }                   &-&-&-&-&-0,04&0,34&-0,002&0.97&-&-&-&-\\
            \rule{0pt}{3ex}\textit{Utilities }                  &0,08&0,11&0,13&0.10&0,12&0,039&0,16&0,053&0,10&0,04&0,16&0,046\\
      \rule{0pt}{3ex}\textit{Shops  }                     &0,052&0,31&0,21&0.04&0,092&0,21&0,25&0,017&0,058&0,25&0,25&0,013\\
           \rule{0pt}{3ex}\textit{Healthcare, Medical Equipment, and Drugs   }&-&-&-0,117&0.14&0,006&0.91&-0,13&0,09&-&-&-0,13&0,094\\

         \rule{0pt}{3ex}\textit{Money:Finance  }&0,054&0,32&0,176&0.04&0,094&0.14&0,20&0,027& 0,06& 0.20& 0,20& 0,016\\

          \rule{0pt}{3ex}\textit{Other  }        &-&-&-&-&0,015&0,85&0,055&0,65&-&-& -& -\\

                      \midrule
                \textit{$R^2$}               &3.03\%&&5.48\%&&3.45\%&&5.63\%&&3.16\%&&5.59\%&\\
                         &(1,21)&&(9,48)&&(1,39)&&(9,74)&&(1,27)&&(9,67)&\\
                    \bottomrule
                    \bottomrule\end{tabular}}%
          \end{center}
            {\footnotesize {%Data Source: \href{http://mba.tuck.dartmouth.edu/pages/faculty/ken.french/data library.html}} \\
                    Note:  The table reports OLS slope coefficient estimates and the $R^{2}$ 
      statistic for the predictive regression model selected by the LASSO. The regressand is the excess return for the industry portfolio in the column heading. The regressors are selected from the complete set of lagged industry excess returns in the first column. Each predictive regression
        model includes an intercept term. Bold (italicized bold) indicates significance at the 10\% (5\%) level according to conventional OLS post-LASSO t-statistics; 

答案1

我提出了此代码,其中我使用了S列类型,从siunitx将数字对齐到小数点,并将表格嵌套在threeparttable表格后的注释环境中。此外,我将l第一列中的列类型替换为列,m以便为长单元格启用自动换行。

最后要说的是:不要使用\resizebox来使表格适合页面,因为这会导致字体大小不一致。还有其他几种解决方案。特别是,我将字体大小减小到footnotesize所有表格内容,并使用较小的值\tabcolsep(默认为 6 pt),这在列很多的情况下很有用。

\documentclass[12pt,notitlepage]{article}
\usepackage[table]{xcolor}
\usepackage{geometry}
\usepackage{amssymb}
\usepackage{amsmath}
%\usepackage{mathbbol}
%\usepackage{bbm}
\usepackage{amsthm}
\usepackage{pdfpages}
\usepackage{graphicx,color,psfrag}
\usepackage{epstopdf}
\usepackage{pdflscape}
\usepackage{tabularx}
\usepackage{longtable}
\usepackage{enumitem}
% caption fonts
\usepackage[font={large,bf}]{caption}
\usepackage{subcaption}

\usepackage{setspace}
\usepackage{longtable}
\usepackage{threeparttable}
\usepackage{tabulary}
\usepackage{booktabs}
\usepackage{float}
\usepackage{rotating}
\usepackage{array,multirow}
\usepackage{threeparttable}
\usepackage{siunitx}
\usepackage{ragged2e}
\usepackage{xurl, hyperref}

\begin{document}

\begin{landscape}
\setlength{\tabcolsep}{3pt}
  \begin{table}[!ht]
    \centering\footnotesize
\begin{threeparttable}
      \caption{Predictive regression estimation results, 1926:07-2021:02}
      \label{tab:table_segregation_occ_stats}
        \begin{tabular}{>{\RaggedRight}m{3cm}|*{6}{S[table-format=-1.3 ]S[table-format=1.3 ]}}
          \toprule
          \toprule
          & \multicolumn{ 4}{c}{\textbf{LASSO}} & \multicolumn{4}{c}{\textbf{OLS}} & \multicolumn{4}{c}{\textbf{ OLS Post-LASSO}} \\
 \cmidrule(lr){2-5}
 \cmidrule(lr){6-9}
 \cmidrule(lr){10-13}
 & \multicolumn{ 2}{c}{NoDur} & \multicolumn{ 2}{c}{Durbl} & \multicolumn{ 2}{c}{NoDur} & \multicolumn{ 2}{c}{Durbl} & \multicolumn{ 2}{c}{NoDur} & \multicolumn{ 2}{c}{Durbl} \\
 \cmidrule(lr){2-3}
 \cmidrule(lr){4-5}
 \cmidrule(lr){6-7}
 \cmidrule(lr){8-9}
 \cmidrule(lr){10-11}
 \cmidrule(lr){12-13}
%
&\multicolumn{1}{c}{Coef.}&\multicolumn{1}{c}{P-value}&\multicolumn{1}{c}{Coef.}&\multicolumn{1}{c}{P-value}&\multicolumn{1}{c}{Coef.}&\multicolumn{1}{c}{P-value}&\multicolumn{1}{c}{Coef.}&\multicolumn{1}{c}{P-value}&\multicolumn{1}{c}{Coef.}&\multicolumn{1}{c}{P-value}&\multicolumn{1}{c}{Coef.}&\multicolumn{1}{c}{P-value}\\
 \cmidrule{2-13}
 \rule{0pt}{3ex}\textit{Consumer Nondurables } &{-}& {-}& -0,086& 0,51& -0,004& 0,966&-0,146& 0.27&{-} & {-} &-0,14&0,26\\
%
 \rule{0pt}{3ex}\textit{Consumer Durables } &{-}&{-}&-0,055&0,41&-0,005&0,920&-0,07&0,29&{-} &{-} &-0,087&0,19\\
 \rule{0pt}{3ex}\textit{Manufacturing } &{-} &{-} & {-} & {-} &-0,014&0.89&-0,070& 0.65&{-} &{-} &{-} &{-} \\
 \rule{0pt}{3ex}\textit{Energy } &-0,094&0,01&-0,120&0.04&-0,112&0,009&-0,13&0.03&-0,12&0,001&-0,13&0,023\\
 \rule{0pt}{3ex}\textit{Chemicals and Allied Products }&{-} &{-} &-0,053&0.62&-0,066&0,433&-0,040&0.73&{-} &{-} &-0,05&0,61\\
%
 \rule{0pt}{3ex}\textit{Business Equipment } &{-} &{-} &0,081& 0,16&0,009&0.83&0,10&0.14&{-} &{-} &0,097&0,098\\
 \rule{0pt}{3ex}\textit{Telecom } &{-} &{-} &{-} &{-} &-0,04&0,34&-0,002&0.97&{-} &{-} &{-} &{-} \\
 \rule{0pt}{3ex}\textit{Utilities } &0,08&0,11&0,13&0.10&0,12&0,039&0,16&0,053&0,10&0,04&0,16&0,046\\
 \rule{0pt}{3ex}\textit{Shops } &0,052&0,31&0,21&0.04&0,092&0,21&0,25&0,017&0,058&0,25&0,25&0,013\\
 \rule{0pt}{3ex}\textit{Healthcare, Medical Equipment, and Drugs }&{-} &{-} &-0,117&0.14&0,006&0.91&-0,13&0,09&{-} &{-} &-0,13&0,094\\
%
 \rule{0pt}{3ex}\textit{Money:Finance }&0,054&0,32&0,176&0.04&0,094&0.14&0,20&0,027& 0,06& 0.20& 0,20& 0,016\\
%
 \rule{0pt}{3ex}\textit{Other } &{-} &{-} &{-} &{-} &0,015&0,85&0,055&0,65&{-} &{-} & {-} & {-} \\
%
 \midrule
 \multicolumn{1}{c}{\textit{$R^2$}} &\multicolumn{2}{c}{3.03\%}&\multicolumn{2}{c}{5.48\%}&\multicolumn{2}{c}{3.45\%}&\multicolumn{2}{c}{5.63\%}&\multicolumn{2}{c}{3.16\%}&\multicolumn{2}{c}{5.59\%}\\
%
 &\multicolumn{2}{c}{(1,21)}&\multicolumn{2}{c}{(9,48)}&\multicolumn{2}{c}{(1,39)}&\multicolumn{2}{c}{(9,74)}&\multicolumn{2}{c}{(1,27)}&\multicolumn{2}{c}{(9,67)}\\
 \bottomrule
 \bottomrule\end{tabular}%
\begin{tablenotes}[flushleft]
\item[\!] Data Source: \url{http://mba.tuck.dartmouth.edu/pages/faculty/ken.french/data library.html}\smallskip

\item[\!]Note: The table reports OLS slope coefficient estimates and the $R^{2}$
 statistic for the predictive regression model selected by the LASSO. The regressand is the excess return for the industry portfolio in the column heading. The regressors are selected from the complete set of lagged industry excess returns in the first column. Each predictive regression
 model includes an intercept term. Bold (italicized bold) indicates significance at the 10\% (5\%) level according to conventional OLS post-LASSO t-statistics; indicates that the lagged industry excess return was not selected by the LASSO. Parentheses report the \cite{campbell2008} measure of the proportional increase in average excess return for a mean-variance investor who utilizes return predictability when allocating between a given industry portfolio and risk-free bills.
 \end{tablenotes}
\end{threeparttable}
  \end{table}
\end{landscape}

\end{document} 

在此处输入图片描述

答案2

我建议您从 a 环境切换tabular到 atabular*环境,并缩短第一列(最左侧)的部分内容。我还建议您加载包siunitx并使用包的S列类型,以便将 12 个数据列中的数字与小数点对齐。

在此处输入图片描述

\documentclass[12pt,notitlepage]{article}
\usepackage[table]{xcolor}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{mathbbol}
\usepackage{bbm}
\usepackage{amsthm}
\usepackage{pdfpages}
\usepackage{graphicx,xcolor,psfrag}
\usepackage{pdflscape}
\usepackage{tabularx}
\usepackage{longtable}
\usepackage{breakurl}
\usepackage{enumitem}

 \usepackage{setspace}
 \usepackage{longtable}
 \usepackage{threeparttable}  
 \usepackage{tabulary}
 \usepackage{booktabs}
 \usepackage{float}
 \usepackage[skip=0.333\baselineskip]{caption}
 \usepackage{subcaption}
 \usepackage{rotating}
 \usepackage{array,multirow}
 \usepackage[output-decimal-marker={,}]{siunitx} % <-- new

% handy short-cut macros:
\newcommand\mc[1]{\multicolumn{1}{c}{#1}}
\newcommand\mcii[1]{\multicolumn{2}{c}{#1}}
\newcommand\mciv[1]{\multicolumn{4}{c}{#1}}

\begin{document}

\begin{sidewaystable}
\setlength\tabcolsep{0pt}
\caption{Predictive regression estimation results, 1926:07--2021:02}
\label{tab:table_segregation_occ_stats}

\footnotesize
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} l 
     *{2}{S[table-format=-1.3]S[table-format=1.2]}
     *{4}{S[table-format=-1.3]S[table-format=1.3]} }
\toprule
& \mciv{LASSO} & \mciv{OLS} & \mciv{OLS Post-LASSO}  \\
\cmidrule{2-5} \cmidrule{6-9} \cmidrule{10-13}
 & \mcii{NonDur} & \mcii{Durbl} 
 & \mcii{NonDur} & \mcii{Durbl} 
 & \mcii{NonDur} & \mcii{Durbl} \\
   \cmidrule{2-3} \cmidrule{4-5}
   \cmidrule{6-7} \cmidrule{8-9}
   \cmidrule{10-11} \cmidrule{12-13}
&\mc{Coef.}&\mc{$p$-val}&\mc{Coef.}&\mc{$p$-val}
&\mc{Coef.}&\mc{$p$-val}&\mc{Coef.}&\mc{$p$-val}
&\mc{Coef.}&\mc{$p$-val}&\mc{Coef.}&\mc{$p$-val}\\
\cmidrule{2-13}
Consumer Nondurables &{--}&{--}& -0,086& 0,51& -0,004& 0,966&-0,146& 0.27&{--}&{--}&-0,14&0,26\\
Consumer Durables &{--}&{--}&-0,055&0,41&-0,005&0,920&-0,07&0,29&{--}&{--} &-0,087&0,19\\
Manufacturing &{--}&{--}&{--}&{--}&-0,014&0.89&-0,070& 0.65&{--}&{--}&{--}&{--}\\
Energy    &-0,094&0,01& -0,120&0.04&-0,112&0,009&-0,13&0.03&-0,12&0,001&-0,13&0,023\\
Chemicals and Allied Products &{--}&{--}&-0,053&0.62&-0,066&0,433&-0,040&0.73&{--}&{--}&-0,05&0,61\\
Business Equipment &{--}&{--}&0,081& 0,16&0,009&0.83&0,10&0.14&{--}&{--}&0,097&0,098\\
Telecom   &{--}&{--}&{--}&{--}&-0,04&0,34&-0,002&0.97&{--}&{--}&{--}&{--}\\
Utilities       &0,08&0,11&0,13&0.10&0,12&0,039&0,16&0,053&0,10&0,04&0,16&0,046\\
Shops  &0,052&0,31&0,21&0.04&0,092&0,21&0,25&0,017&0,058&0,25&0,25&0,013\\
Healthcare, Med.\ Equip., Drugs   &{--}&{--}&-0,117&0.14&0,006&0.91&-0,13&0,09&{--}&{--}&-0,13&0,094\\
Money: Finance  &0,054&0,32&0,176&0.04&0,094&0.14&0,20&0,027& 0,06& 0.20& 0,20& 0,016\\
Other   &{--}&{--}&{--}&{--}&0,015&0,85&0,055&0,65&{--}&{--}&{--}&{--}\\
\midrule
R\textsuperscript{2}  &\mc{3,03\%}&&\mc{5,48\%}&&\mc{3,45\%}&&\mc{5,63\%}&&\mc{3,16\%}&&\mc{5,59}\% &\\
       &\mc{(1,21)}&&\mc{(9,48)}&&\mc{(1,39)}&&\mc{(9,74)}&&\mc{(1,27)}&&\mc{(9,67)} &\\
\bottomrule
\end{tabular*}

\medskip
\textsc{Notes}:  The table reports OLS slope coefficient estimates and the $R^{2}$ statistic for the predictive regression model selected by the LASSO. The regressand is the excess return for the industry portfolio in the column heading. The regressors are selected from the complete set of lagged industry excess returns in the first column. Each predictive regression model includes an intercept term. Bold (italicized bold) indicates significance at the 10\% (5\%) level according to conventional OLS post-LASSO $t$-statistics; 

答案3

\documentclass[12pt,notitlepage]{article}
\usepackage[table]{xcolor}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{mathbbol}
\usepackage{bbm}
\usepackage{amsthm}
\usepackage{pdfpages}
\usepackage{graphicx,color,psfrag}
\usepackage{epstopdf}
\usepackage{pdflscape}
\usepackage{tabularx}
\usepackage{longtable}
\usepackage{breakurl}
\usepackage{enumitem}
% caption fonts
\usepackage[font={large,bf}]{caption} 

\usepackage{setspace}
\usepackage{longtable}
\usepackage{threeparttable}  
\usepackage{tabulary}
\usepackage{booktabs}
\usepackage{float}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{rotating}
\usepackage{array,multirow}

\begin{document}
\begin{landscape}
  \begin{table}[!ht]
    \begin{center}
      \caption{Predictive regression estimation results, 1926:07-2021:02}
      \label{tab:table_segregation_occ_stats}
      \resizebox{1.34\textwidth}{!}{
        \begin{tabular}{lcccccccccccc}
          \toprule
          \toprule
          & \multicolumn{ 4}{c}{\textbf{LASSO}} & \multicolumn{4}{c}{\textbf{OLS}} & \multicolumn{4}{c}{\textbf{ OLS Post-LASSO
                                                                                     }}  \\
          \cmidrule(lr){2-5}
          \cmidrule(lr){6-9}
          \cmidrule(lr){10-13}
          & \multicolumn{ 2}{c}{NoDur} & \multicolumn{ 2}{c}{Durbl} & \multicolumn{ 2}{c}{NoDur} & \multicolumn{ 2}{c}{Durbl} & \multicolumn{ 2}{c}{NoDur} & \multicolumn{ 2}{c}{Durbl} \\
          \cmidrule(lr){2-3}
          \cmidrule(lr){4-5}
          \cmidrule(lr){6-7}
          \cmidrule(lr){8-9}
          \cmidrule(lr){10-11}
          \cmidrule(lr){12-13}
          &\multicolumn{1}{c}{Coef.}&\multicolumn{1}{c}{P-value}&\multicolumn{1}{c}{Coef.}&\multicolumn{1}{c}{P-value}&\multicolumn{1}{c}{Coef.}&\multicolumn{1}{c}{P-value}&\multicolumn{1}{c}{Coef.}&\multicolumn{1}{c}{P-value}&\multicolumn{1}{c}{Coef.}&\multicolumn{1}{c}{P-value}&\multicolumn{1}{c}{Coef.}&\multicolumn{1}{c}{P-value}\\
          \cmidrule{2-13}
          \rule{0pt}{3ex}\textit{Consumer Nondurables  }   &-& -& -0,086& 0,51& -0,004& 0,966&-0,146& 0.27&-& -&-0,14&0,26\\

          \rule{0pt}{3ex}\textit{Consumer Durables  }     &-&-&-0,055&0,41&-0,005&0,920&-0,07&0,29&-&-&-0,087&0,19\\
          \rule{0pt}{3ex}\textit{Manufacturing    }       &-&-& -& -&-0,014&0.89&-0,070& 0.65&-&-&-&-\\
          \rule{0pt}{3ex}\textit{Energy  }                &-0,094&0,01&-0,120&0.04&-0,112&0,009&-0,13&0.03&-0,12&0,001&-0,13&0,023\\
          \rule{0pt}{3ex}\textit{Chemicals and Allied Products  }&-&-&-0,053&0.62&-0,066&0,433&-0,040&0.73&-&-&-0,05&0,61\\

          \rule{0pt}{3ex}\textit{Business Equipment   }       &-&-&0,081& 0,16&0,009&0.83&0,10&0.14&-&-&0,097&0,098\\
          \rule{0pt}{3ex}\textit{Telecom  }                   &-&-&-&-&-0,04&0,34&-0,002&0.97&-&-&-&-\\
          \rule{0pt}{3ex}\textit{Utilities }                  &0,08&0,11&0,13&0.10&0,12&0,039&0,16&0,053&0,10&0,04&0,16&0,046\\
          \rule{0pt}{3ex}\textit{Shops  }                     &0,052&0,31&0,21&0.04&0,092&0,21&0,25&0,017&0,058&0,25&0,25&0,013\\
          \rule{0pt}{3ex}\textit{Healthcare, Medical Equipment, and Drugs   }&-&-&-0,117&0.14&0,006&0.91&-0,13&0,09&-&-&-0,13&0,094\\

          \rule{0pt}{3ex}\textit{Money:Finance  }&0,054&0,32&0,176&0.04&0,094&0.14&0,20&0,027& 0,06& 0.20& 0,20& 0,016\\

          \rule{0pt}{3ex}\textit{Other  }        &-&-&-&-&0,015&0,85&0,055&0,65&-&-& -& -\\

          \midrule
          \multicolumn{1}{c}{\textit{$R^2$}}               &\multicolumn{2}{c}{3.03\%}&\multicolumn{2}{c}{5.48\%}&\multicolumn{2}{c}{3.45\%}&\multicolumn{2}{c}{5.63\%}&\multicolumn{2}{c}{3.16\%}&\multicolumn{2}{c}{5.59\%}\\
          &\multicolumn{2}{c}{(1,21)}&\multicolumn{2}{c}{(9,48)}&\multicolumn{2}{c}{(1,39)}&\multicolumn{2}{c}{(9,74)}&\multicolumn{2}{c}{(1,27)}&\multicolumn{2}{c}{(9,67)}\\
          \bottomrule
          \bottomrule\end{tabular}}%
    \end{center}
    {\footnotesize {%Data Source: \href{http://mba.tuck.dartmouth.edu/pages/faculty/ken.french/data library.html}} \\
        Note:  The table reports OLS slope coefficient estimates and the $R^{2}$ 
        statistic for the predictive regression model selected by the LASSO. The regressand is the excess return for the industry portfolio in the column heading. The regressors are selected from the complete set of lagged industry excess returns in the first column. Each predictive regression
        model includes an intercept term. Bold (italicized bold) indicates significance at the 10\% (5\%) level according to conventional OLS post-LASSO t-statistics; 

相关内容