在迴歸結果表下加入顯著性水平

在迴歸結果表下加入顯著性水平

我有一個表格如下:

\begin{table}[htbp]\centering
\caption{Dependent Variable: Enrollment}
\begin{tabular}{c c c c}
\hline\hline 
\textbf{Variable} & \textbf{Model 1} & \textbf{Model 2} & \textbf{Model 3}\\ \hline
frl         &      -0.012   &      -0.052   &      -0.156** \\
            &      (0.04)   &      (0.06)   &      (0.06)   \\
minority    &               &       0.034   &       0.097*  \\
            &               &      (0.05)   &      (0.04)   \\
disting     &               &               &       0.439***\\
            &               &               &      (0.06)   \\
cons       &       0.529***&       0.530***&       0.518***\\
            &      (0.03)   &      (0.03)   &      (0.02)   \\
\hline  N           &     196   &     196   &     196   \\          
R$^{2}$           &       0.001   &       0.003   &       0.235   \\
\hline
\end{tabular}
\end{table}

我想添加下面的統計顯著性星星,但我似乎無法添加具有三個多列的程式碼。我嘗試在表末尾添加以下內容,但似乎不起作用:

\bottomrule
\vspace{-3mm}\\
\multicolumn{3}{l}{\textsuperscript{***}$p<0.01$, 
  \textsuperscript{**}$p<0.05$, 
  \textsuperscript{*}$p<0.1$, 

我怎樣才能添加文字上標?

答案1

事實上,您可以使用包包中的\multicolumnand :\addlinespacebooktabs

\documentclass{article}
\usepackage{booktabs}

\begin{document}

\begin{table}[htbp]\centering
\caption{Dependent Variable: Enrollment}
\begin{tabular}{c c c c}
\toprule
\textbf{Variable} & \textbf{Model 1} & \textbf{Model 2} & \textbf{Model 3}\\ 
\midrule
frl         &      -0.012   &      -0.052   &      -0.156** \\
            &      (0.04)   &      (0.06)   &      (0.06)   \\
minority    &               &       0.034   &       0.097*  \\
            &               &      (0.05)   &      (0.04)   \\
disting     &               &               &       0.439***\\
            &               &               &      (0.06)   \\
cons       &       0.529***&       0.530***&       0.518***\\
            &      (0.03)   &      (0.03)   &      (0.02)   \\
\midrule
 N           &     196   &     196   &     196   \\          
R$^{2}$           &       0.001   &       0.003   &       0.235   \\
\bottomrule
\addlinespace[1ex]
\multicolumn{3}{l}{\textsuperscript{***}$p<0.01$, 
  \textsuperscript{**}$p<0.05$, 
  \textsuperscript{*}$p<0.1$}
\end{tabular}
\end{table}

\end{document}

在此輸入影像描述

下面還有另一種可能性,使用ctable包裹;我使用了一些框框來隱藏上標字元的寬度:

\documentclass{article}
\usepackage{ctable}
\usepackage{booktabs}

\begin{document}

\ctable[
  notespar,
  caption={Dependent Variable: Enrollment}
]{c c c c}
{\tnote[*]{$p<0.1$}\tnote[**]{$p<0.5$}\tnote[***]{$p<0.01$}}{
\toprule
\textbf{Variable} & \textbf{Model 1} & \textbf{Model 2} & \textbf{Model 3}\\ 
\midrule
frl         &      -0.012   &      -0.052   &      -0.156\tmark[{\makebox[0pt][l]{**}}] \\
            &      (0.04)   &      (0.06)   &      (0.06)   \\
minority    &               &       0.034   &       0.097\tmark[{\makebox[0pt][l]{*}}]  \\
            &               &      (0.05)   &      (0.04)   \\
disting     &               &               &       0.439\tmark[{\makebox[0pt][l]{***}}]\\
            &               &               &      (0.06)   \\
cons       &       0.529\tmark[{\makebox[0pt][l]{***}}]&       0.530\tmark[{\makebox[0pt][l]{***}}]&       0.518\tmark[{\makebox[0pt][l]{***}}]\\
            &      (0.03)   &      (0.03)   &      (0.02)   \\
\midrule  
N           &     196   &     196   &     196   \\          
R$^{2}$           &       0.001   &       0.003   &       0.235   \\
\bottomrule}

\end{document}

在此輸入影像描述

如果沒有booktabsnor ctable,您可以執行以下操作:

\documentclass{article}
\usepackage{booktabs}

\begin{document}

\begin{table}[htbp]\centering
\caption{Dependent Variable: Enrollment}
\begin{tabular}{c c c c}
\hline\hline
\textbf{Variable} & \textbf{Model 1} & \textbf{Model 2} & \textbf{Model 3}\\ 
\hline
frl         &      -0.012   &      -0.052   &      -0.156** \\
            &      (0.04)   &      (0.06)   &      (0.06)   \\
minority    &               &       0.034   &       0.097*  \\
            &               &      (0.05)   &      (0.04)   \\
disting     &               &               &       0.439***\\
            &               &               &      (0.06)   \\
cons       &       0.529***&       0.530***&       0.518***\\
            &      (0.03)   &      (0.03)   &      (0.02)   \\
\hline
 N           &     196   &     196   &     196   \\          
R$^{2}$           &       0.001   &       0.003   &       0.235   \\
\hline
\\[-1.75ex]
\multicolumn{3}{l}{\textsuperscript{***}$p<0.01$, 
  \textsuperscript{**}$p<0.05$, 
  \textsuperscript{*}$p<0.1$}
\end{tabular}
\end{table}

\end{document}

在此輸入影像描述

答案2

tabular只要是\multicolumn儲存格中的第一個元素,在 底部新增內容就沒有問題:

在此輸入影像描述

\documentclass{article}
\usepackage{booktabs}% http://ctan.org/pkg/booktabs
\begin{document}

\begin{table}[htbp]
  \centering
  \caption{Dependent Variable: Enrollment}
  \begin{tabular}{c r@{}l r@{}l r@{}l}
    \toprule
    \textbf{Variable} & 
      \multicolumn{2}{c}{\textbf{Model 1}} & 
      \multicolumn{2}{c}{\textbf{Model 2}} & 
      \multicolumn{2}{c}{\textbf{Model 3}} \\
    \midrule
    frl         &  $-$0&.012   &  $-$0&.052   &  $-$0&.156\textsuperscript{**}  \\
                &    (0&.04)   &    (0&.06)   &    (0&.06)    \\
    minority    &      &       &     0&.034   &     0&.097\textsuperscript{*}   \\
                &      &       &    (0&.05)   &    (0&.04)    \\
    disting     &      &       &      &       &     0&.439\textsuperscript{***} \\
                &      &       &      &       &    (0&.06)    \\
    cons        &     0&.529\textsuperscript{***}&     0&.530\textsuperscript{***}&     0&.518\textsuperscript{***} \\
                &    (0&.03)   &    (0&.03)   &    (0&.02)    \\
    \midrule
    N           &   196&       &   196&       &   196&        \\          
    R$^{2}$     &     0&.001   &     0&.003   &     0&.235    \\
  \bottomrule
  \multicolumn{3}{l}{\rule{0pt}{1.2\normalbaselineskip}% strut
    \textsuperscript{***}$p < 0.01$, 
    \textsuperscript{**}$p < 0.05$, 
    \textsuperscript{*}$p < 0.1$} 
  \end{tabular}
\end{table}

\end{document}

為了保持一致性,如果您使用\textsuperscript引用表下方的元件,則項目也應使用\textsuperscript.此外,在小數點處對齊tabular內容可能會很有趣(正如我上面所做的那樣,使用窮人的D列)。

答案3

鑑於資料列包含帶小數的數字,如果數字在小數標記上對齊,這對讀者非常有幫助。這可以透過使用該dcolumn套件並定義合適的小數樣式列類型來實現。使用這種方法的一個附帶好處是,-附加到負數的符號將被排版為正確的數學“減”符號,而不是短的“破折號”。

正如前面的答案中已經指出的那樣,您 (i) 可以通過將資訊包含在\multicolumn{4}{l}{...}語句中,將有關標準誤差和顯著性水平的圖例放置在表底部的行中,並且 (ii) 可能想要使用booktabs包及其命令\toprule\midrule等來獲得間隔良好的水平線。

在此輸入影像描述

\documentclass{article}
\usepackage{booktabs,dcolumn}
\newcolumntype{d}{D{.}{.}{2.5}}           % alignment on decimal marker
\newcommand\mc[1]{\multicolumn{1}{c}{#1}} % shorthand macro
\begin{document}
\begin{table}
\centering
\caption{Dependent Variable: Enrollment}
\begin{tabular}{l ddd}
\toprule
\textbf{Regressor}       & \mc{\textbf{Model 1}} 
&  \mc{\textbf{Model 2}} & \mc{\textbf{Model 3}} \\
\midrule
frl        & -0.012   & -0.052   &      -0.156^{**} \\
           & (0.04)   & (0.06)   &      (0.06)      \\
minority   &          &  0.034   &       0.097^{*}  \\
           &          & (0.05)   &      (0.04)      \\
disting    &          &          &       0.439^{***}\\
           &          &          &      (0.06)      \\
cons       &  0.529^{***}& 0.530^{***}&  0.518^{***}\\
           & (0.03)      &(0.03)      &  (0.02)     \\
\midrule
$N$        & \mc{196} & \mc{196} &    \mc{196}   \\
$R^{2}$    &  0.001   &  0.003   &       0.235   \\
\midrule[\heavyrulewidth]
\multicolumn{4}{l}{(Standard errors in parentheses)}\\
\multicolumn{4}{l}{$^{***}\ p<0.01$; $^{**}\ p<0.05$; $^{*}\ p<0.1$}\\
\end{tabular}
\end{table}
\end{document} 

相關內容