Gostaria de obter essas linhas abaixo do cabeçalho das colunas como no exemplo que mostro abaixo
Eu tentei usar \multicolumn{3}{c}{-}
, mas não funciona. Nem o uso \midrule
nem outras coisas funcionaram. Alguma dica?
Código completo abaixo para fins de integridade
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{rotating}
\usepackage{booktabs,tabularx,dcolumn,adjustbox}
\usepackage[flushleft]{threeparttable}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\newcolumntype{d}[1]{D..{#1}}
\usepackage[font=large,skip=.333\baselineskip]{caption}
\usepackage[margin=0.5in]{geometry}
\newcommand\mc[1]{\multicolumn{1}{c}{#1}}
\newcommand\mC[1]{\multicolumn{1}{c}{\begin{tabular}[t]{@{}c@{}}#1\end{tabular}}}
\newcommand\ic[1]{\multicolumn{1}{D..{6.2}}{#1}}
\newcommand\pc[1]{\multicolumn{1}{D..{0.1}}{#1}}
\begin{document}
\begin{center}
\begin{threeparttable}
\captionof{table}{Labour and money control}
\begin{tabular}{@{} l *{7}{d{2.5}} @{}}
\toprule\toprule
&\multicolumn{3}{c}{\textbf{Poor sample}}&\multicolumn{3}{c}{\textbf{Rich sample}}\\
&\cline{1-3}&\cline{4-6}
& \mc{(1)} & \mc{(2)} & \mc{(3)} & \mc{(4)} & \mc{(5)} & \mc{(6)} \\\midrule
\addlinespace
Outcome & \mC{OLS}
& \mC{RF}
& \mC{IV}
& \mC{OLS}
& \mC{RF}
& \mC{IV}\\
\midrule
Employed & 0.002 & 0.0107 & 0.0276 & 0.0144^{***}&0.0618^{*}& 0.316 \\
& (0.003) & (0.0286) &(0.0755)& (0.003) & (0.0332) & (0.444)\\
\addlinespace
Agricultural job & -0.003 & -0.004& -0.0056&-0.0213^{***}&0.0558 & 0.212\\
& (0.004) & (0.0315) & (0.0466)& (0.0313)& (0.0218) & (0.235) \\
\addlinespace
Paid job & 0.001 & -0.079^{*} &-0.167& 0.0317^{***}&-0.125^{*}& 0.559\\
& (0.004) & (0.0437) & (0.123) & (0.003) & (0.0528) & (0.785) \\
\addlinespace
Self employed & 0.005 & 0.007 &0.008& -0.0253^{***}&-0.0458& 0.485\\
& (0.004) & (0.0424) & (0.0501) & (0.004) & (0.0419) & (1.793) \\
\addlinespace
Family worker & -0.003 & 0.0296 &-0.0370&-0.004&0.0451^{*}& -0.722\\
& (0.003) & (0.0362) & (0.0424) & (0.003) & (0.0268) & (3.551) \\
\addlinespace
Own earings decision & 0.0141^{*} & -0.0107^{*} &-0.009& 0.0123^{***}&0.0688& 0.458\\
& (0.008) & (0.0840) & (0.0726) & (0.004) & (0.0572) & (1.504) \\
\addlinespace
Husband's earings decision & 0.0140^{***} & 0.0739^{*} &0.0221^{***}& 0.0123^{***}&-0.0303& -0.106\\
& (0.004) & (0.0507) & (0.0737) & (0.003) & (0.0512) & (0.175) \\
\addlinespace
\textit{Mean} & \pc{0.71}& \pc{0.39}& \pc{0.44} & \pc{0.70} & \pc{0.14}& \pc{3.16}\\
Bandwidth & \ic{34} & \ic{35} & \ic{32} & \ic{29}& \ic{23}& \ic{34}\\
Obs & \ic{4,322} & \ic{4,454} & \ic{2,822}& \ic{2,630}& \ic{2,109}& \ic{4,454}\\
\bottomrule
\addlinespace
\multicolumn{7}{c}{ $^{***}\ p<0.01$; $^{**}\ p<0.05$; $^{*}\ p<0.1$} \\
\end{tabular}
\begin {tablenotes}
\small
\item Notes:
\end{tablenotes}
\end{threeparttable}
\end{center}
\end{document}
Como ter as duas linhas no mesmo nível?
Responder1
Conforme você usa, booktabs
aqui está uma versão totalmente funcional com \cmidrule
. Isso (lr)
encurta um pouco a barra.
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{rotating}
\usepackage{booktabs,tabularx,dcolumn,adjustbox}
\usepackage[flushleft]{threeparttable}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\newcolumntype{d}[1]{D..{#1}}
\usepackage[font=large,skip=.333\baselineskip]{caption}
\usepackage[margin=0.5in]{geometry}
\newcommand\mc[1]{\multicolumn{1}{c}{#1}}
\newcommand\mC[1]{\multicolumn{1}{c}{\begin{tabular}[t]{@{}c@{}}#1\end{tabular}}}
\newcommand\ic[1]{\multicolumn{1}{D..{6.2}}{#1}}
\newcommand\pc[1]{\multicolumn{1}{D..{0.1}}{#1}}
\begin{document}
\begin{center}
\begin{threeparttable}
\captionof{table}{Labour and money control}
\begin{tabular}{@{} l *{7}{d{2.5}} @{}}
\toprule
&\multicolumn{3}{c}{\textbf{Poor sample}}&\multicolumn{3}{c}{\textbf{Rich sample}}\\\cmidrule(lr){2-4}\cmidrule(lr){5-7}
& \mc{(1)} & \mc{(2)} & \mc{(3)} & \mc{(4)} & \mc{(5)} & \mc{(6)} \\\midrule
\addlinespace
Outcome & \mC{OLS}
& \mC{RF}
& \mC{IV}
& \mC{OLS}
& \mC{RF}
& \mC{IV}\\
\midrule
Employed & 0.002 & 0.0107 & 0.0276 & 0.0144^{***}&0.0618^{*}& 0.316 \\
& (0.003) & (0.0286) &(0.0755)& (0.003) & (0.0332) & (0.444)\\
\addlinespace
Agricultural job & -0.003 & -0.004& -0.0056&-0.0213^{***}&0.0558 & 0.212\\
& (0.004) & (0.0315) & (0.0466)& (0.0313)& (0.0218) & (0.235) \\
\addlinespace
Paid job & 0.001 & -0.079^{*} &-0.167& 0.0317^{***}&-0.125^{*}& 0.559\\
& (0.004) & (0.0437) & (0.123) & (0.003) & (0.0528) & (0.785) \\
\addlinespace
Self employed & 0.005 & 0.007 &0.008& -0.0253^{***}&-0.0458& 0.485\\
& (0.004) & (0.0424) & (0.0501) & (0.004) & (0.0419) & (1.793) \\
\addlinespace
Family worker & -0.003 & 0.0296 &-0.0370&-0.004&0.0451^{*}& -0.722\\
& (0.003) & (0.0362) & (0.0424) & (0.003) & (0.0268) & (3.551) \\
\addlinespace
Own earings decision & 0.0141^{*} & -0.0107^{*} &-0.009& 0.0123^{***}&0.0688& 0.458\\
& (0.008) & (0.0840) & (0.0726) & (0.004) & (0.0572) & (1.504) \\
\addlinespace
Husband's earings decision & 0.0140^{***} & 0.0739^{*} &0.0221^{***}& 0.0123^{***}&-0.0303& -0.106\\
& (0.004) & (0.0507) & (0.0737) & (0.003) & (0.0512) & (0.175) \\
\addlinespace
\textit{Mean} & \pc{0.71}& \pc{0.39}& \pc{0.44} & \pc{0.70} & \pc{0.14}& \pc{3.16}\\
Bandwidth & \ic{34} & \ic{35} & \ic{32} & \ic{29}& \ic{23}& \ic{34}\\
Obs & \ic{4,322} & \ic{4,454} & \ic{2,822}& \ic{2,630}& \ic{2,109}& \ic{4,454}\\
\bottomrule
\addlinespace
\multicolumn{7}{c}{ $^{***}\ p<0.01$; $^{**}\ p<0.05$; $^{*}\ p<0.1$} \\
\end{tabular}
\begin {tablenotes}
\small
\item Notes:
\end{tablenotes}
\end{threeparttable}
\end{center}
\end{document}