
Ich habe eine Tabelle wie die folgende:
\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}
Ich würde unten gerne die Sterne für die statistische Signifikanz hinzufügen, aber ich kann anscheinend keinen Code mit drei mehrspaltigen Spalten hinzufügen. Ich habe versucht, am Ende der Tabelle Folgendes hinzuzufügen, aber es scheint nicht zu funktionieren:
\bottomrule
\vspace{-3mm}\\
\multicolumn{3}{l}{\textsuperscript{***}$p<0.01$,
\textsuperscript{**}$p<0.05$,
\textsuperscript{*}$p<0.1$,
Wie kann ich hochgestellte Textzeichen hinzufügen?
Antwort1
Sie können tatsächlich ein \multicolumn
und \addlinespace
aus dem booktabs
Paket verwenden:
\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}
Unten finden Sie eine weitere Möglichkeit mit demctable
Paket; ich habe einige Kästchen verwendet, um die Breite der hochgestellten Zeichen zu begrenzen:
\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}
Ohne booktabs
nor ctable
können Sie beispielsweise Folgendes tun:
\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}
Antwort2
Das Hinzufügen des Inhalts am Ende von ist kein Problem tabular
, solange \multicolumn
es sich um das erste Element in einer Zelle handelt:
\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
Wenn Sie zur Referenzierung der Komponenten unterhalb der Tabelle verwenden, sollten Elemente aus Konsistenzgründen ebenfalls verwenden. Darüber hinaus kann es von Interesse sein, den Inhalt am Dezimalpunkt \textsuperscript
auszurichten (wie ich es oben mithilfe einer -Spalte für Arme getan habe).tabular
D
Antwort3
Da die Datenspalten Zahlen mit Dezimalstellen enthalten, ist es für den Leser sehr hilfreich, wenn die Zahlen an den Dezimaltrennzeichen ausgerichtet sind. Dies kann erreicht werden, indem das dcolumn
Paket verwendet und ein geeigneter Spaltentyp im Dezimalformat definiert wird. Ein Nebeneffekt dieses Ansatzes besteht darin, dass die -
an negative Zahlen angehängten Symbole als richtige mathematische „Minus“-Symbole und nicht als kurze „Striche“ gesetzt werden.
Wie bereits in den früheren Antworten erwähnt, können Sie (i) die Legende zu den Standardfehlern und Signifikanzniveaus in Zeilen am unteren Ende der Tabelle platzieren, indem Sie die Informationen in \multicolumn{4}{l}{...}
Anweisungen einschließen, und (ii) möchten Sie möglicherweise stattdessen das booktabs
Paket und seine Befehle \toprule
, \midrule
, usw. verwenden, um horizontale Linien mit gleichmäßigem Abstand zu erhalten.
\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}