I'm very happy with my table so far but there are some problems that I hope someone here can help me with:
- Using "***" and "-" causes my numbers to misalign, is it a way to align them?
- I can't add another row (or, for some strange reason, add more stars in the last column using ^{**}) without getting an error message when I try to recompile.
- Variable Y is not actually centered above the numbers (more obvious when I have the actual numbers in there), is that possible to adjust?
- For some reason my variable name get an error-message saying "Missing $ inserted", why is that?
Help would be greatly appreciated!
/Adam
\usepackage[utf8]{inputenc}
\usepackage{dcolumn}
\newcolumntype{d}[1]{D..{#1}}
\usepackage[margin=1in]{geometry}
\usepackage{booktabs,caption}
\captionsetup[table]{name=Table}
\captionsetup{skip=0pt}% no extra space below caption
\usepackage[flushleft]{threeparttable}
\newcommand\mc[1]{\multicolumn{1}{c}{#1}} % handy shortcut macro
\begin{document}
%------------- Table -----------------------------
\begin{table}[!htbp]
\centering
\begin{threeparttable}
\caption{This is a sentence that describes the table}
\label{table2}
\begin{tabular}{@{} l *{6}{d{8.3}} @{}}
\toprule
& \multicolumn{4}{c}{One type} & \multicolumn{2}{c@{}}{Another type} \\
\cmidrule(lr){2-5} \cmidrule(l){6-7}
& \mc{(1)} & \mc{(2)} & \mc{(3)} & \mc{(4)} & \mc{(5)} & \mc{(6)} \\
\addlinespace
Dep. Var. & \mc{Var Y} & \mc{Var Y} & \mc{Var Y} & \mc{Var Y} & \mc{Var Y} & \mc{Var Y} \\
\midrule
W[p$_{t-1}$] & \mc{1,000,000^{***}} & \mc{1,000,000^{**}} & \mc{1,000,000^{**}} & \mc{1,000,000^{**}} & \mc{1,000,000^{**}} & \mc{1,000,000^{**}} \\
\quad & \mc{(500,000)} & \mc{(500,000)} & \mc{(500,000)} & \mc{(500,000)} & \mc{(500,000)} & \mc{(500,000)} \\ \addlinespace
W[p$_{t-1}$]$^2$ & \mc{-1,000,000^{***}} & \mc{-1,000,000^{**}} & \mc{−1,000,000^{**}} & \mc{-1,000,000^{**}} & \mc{-1,000,000^{**}} & \mc{-1,000,000} \\
\quad & \mc{(500,000)} & \mc{(500,000)} & \mc{(500,000)} & \mc{(500,000)} & \mc{(500,000)} & \mc{(500,000)} \\ \addlinespace
W[p$_{t-1}$]$^3$ & \mc{1,000,0004^{***}} & \mc{1,000,000^{**}} & \mc{1,000,000^{**}} & \mc{1,000,000^{**}} & \mc{1,000,000^{**}} & \mc{1,000,000} \\
\quad & \mc{(500,000)} & \mc{(500,000)} & \mc{(500,000)} & \mc{(500,000)} & \mc{(500,000)} & \mc{(500,000)} \\
\addlinespace
\addlinespace
W[p$_{t-1}$] & \mc{1,000,000^{***}} & \mc{1,000,000^{**}} & \mc{1,000,000^{**}} & \mc{1,000,000^{**}} & \mc{1,000,000^{**}} & \mc{1,000,000^{**}} \\
\quad & \mc{(500,000)} & \mc{(500,000)} & \mc{(500,000)} & \mc{(500,000)} & \mc{(500,000)} & \mc{(500,000)} \\ \addlinespace
W[p$_{t-1}$]$^2$ & \mc{-1,000,000^{***}} & \mc{-1,000,000^{**}} & \mc{−1,000,000^{**}} & \mc{-1,000,000^{**}} & \mc{-1,000,000^{**}} & \mc{-1,000,000} \\
\quad & \mc{(500,000)} & \mc{(500,000)} & \mc{(500,000)} & \mc{(500,000)} & \mc{(500,000)} & \mc{(500,000)} \\ \addlinespace
W[p$_{t-1}$]$^3$ & \mc{1,000,0004^{***}} & \mc{1,000,000^{**}} & \mc{1,000,000^{**}} & \mc{1,000,000^{**}} & \mc{1,000,000^{**}} & \mc{1,000,000} \\
\quad & \mc{(500,000)} & \mc{(500,000)} & \mc{(500,000)} & \mc{(500,000)} & \mc{(500,000)} & \mc{(500,000)} \\
\addlinespace
\addlinespace
W[p$_{t-1}$] & \mc{1,000,000^{***}} & \mc{1,000,000^{**}} & \mc{1,000,000^{**}} & \mc{1,000,000^{**}} & \mc{1,000,000^{**}} & \mc{1,000,000^{**}} \\
\quad & \mc{(500,000)} & \mc{(500,000)} & \mc{(500,000)} & \mc{(500,000)} & \mc{(500,000)} & \mc{(500,000)} \\ \addlinespace
W[p$_{t-1}$]$^2$ & \mc{-1,000,000^{***}} & \mc{-1,000,000^{**}} & \mc{−1,000,000^{**}} & \mc{-1,000,000^{**}} & \mc{-1,000,000^{**}} & \mc{-1,000,000} \\
\quad & \mc{(500,000)} & \mc{(500,000)} & \mc{(500,000)} & \mc{(500,000)} & \mc{(500,000)} & \mc{(500,000)} \\ \addlinespace
W[p$_{t-1}$]$^3$ & \mc{1,000,0004^{***}} & \mc{1,000,000^{**}} & \mc{1,000,000^{**}} & \mc{1,000,000^{**}} & \mc{1,000,000^{**}} & \mc{1,000,000} \\
\quad & \mc{(500,000)} & \mc{(500,000)} & \mc{(500,000)} & \mc{(500,000)} & \mc{(500,000)} & \mc{(500,000)} \\
\addlinespace
\addlinespace
Month & \mc{Yes} & \mc{Yes} & \mc{Yes} & \mc{Yes} & \mc{Yes} & \mc{Yes} \\
Year & \mc{No} & \mc{Yes} & \mc{Yes} & \mc{Yes} & \mc{No} & \mc{Yes} \\
\midrule
Observations & \mc{10,000} & \mc{10,000} & \mc{10,000} & \mc{10,000} & \mc{10,000} & \mc{10,000} \\
Groups & \mc{150} & \mc{150} & \mc{150} & \mc{150} & \mc{150} & \mc{150} \\
\midrule
{R-squared:} \\
{within} & \mc{0.150} & \mc{0.150} & \mc{0.150} & \mc{0.150} & \mc{0.150} & \mc{0.150} \\
{between} & \mc{0.150} & \mc{0.150} & \mc{0.150} & \mc{0.150} & \mc{0.150} & \mc{0.150} \\
{overall} & \mc{0.150} & \mc{0.150} & \mc{0.150} & \mc{0.150} & \mc{0.150} & \mc{0.150} \\
\bottomrule
\end{tabular}
\begin{tablenotes}
\small
\item $^{*}\ p<0.05$; $^{**}\ p<0.01$; $^{***}\ p<0.001$.
\end{tablenotes}
\end{threeparttable}
\end{table}
%-------------------------------- End Table ---------------------------------
\end{document}
D
columns and overriding each entry with\mc
is useless.^
outside of math mode.