\回归表中的 clines 未对齐

\回归表中的 clines 未对齐

我使用 R 中的 stargazer 包导出 LaTeX 的回归表。我尝试编辑代码以显示男性和女性子集的分组,但命令\cline错位了大约 15 个像素,我无法弄清楚原因。

问题出在这部分:

& \multicolumn{3}{c}{\textit{Female:}} & \multicolumn{3}{c} 
{\textit{Male:}} 
\\\cline{2-4} & \cline{4-6}

完整代码块及输出如下:

\begin{landscape}\begin{table}[!htbp] \centering 
\caption{Household Production Minutes: Full Sample} 
\label{tab:min} \scalebox{.70}{  
\begin{tabular}{@{\extracolsep{5pt}}lD{.}{.}{-3} D{.}{.}{-3} D{.}{.} 
{-3} D{.}{.}{-3} D{.}{.}{-3} D{.}{.}{-3} } 
\\[-1.8ex]\hline 
\hline \\[-1.8ex] 
& \multicolumn{3}{c}{\textit{Female:}} & \multicolumn{3}{c} 
{\textit{Male:}} 
\\\cline{2-4} & \cline{4-6}
\\[-1.8ex] & \multicolumn{1}{c}{Total Household Production} & 
\multicolumn{1}{c}{Chore Minutes} & \multicolumn{1}{c}{Parenting 
Minutes} & \multicolumn{1}{c}{Total Household Production} & 
\multicolumn{1}{c}{Chore Minutes} & \multicolumn{1}{c}{Parenting 
Minutes} \\ 
\\[-1.8ex] & \multicolumn{1}{c}{(1)} & \multicolumn{1}{c}{(2)} & 
\multicolumn{1}{c}{(3)} & \multicolumn{1}{c}{(4)} & \multicolumn{1}{c} 
{(5)} & \multicolumn{1}{c}{(6)}\\ 
\hline \\[-1.8ex] 
Income Share & -11.280 & -44.380^{***} & 54.654^{**} & -27.438^{***} & 
-23.011^{***} & -7.523 \\ 
& (17.360) & (12.041) & (25.994) & (6.601) & (4.429) & (7.563) \\ 
& & & & & & \\ 
Education Difference & -6.791 & -1.060 & -12.021^{*} & -2.431 & -2.362 
& 1.915 \\ 
& (4.760) & (3.302) & (6.788) & (2.147) & (1.440) & (2.409) \\ 
& & & & & & \\ 
Age & -1.541^{**} & 1.218^{***} & -5.477^{***} & -0.823^{***} & 0.022 
& -1.812^{***} \\ 
& (0.604) & (0.419) & (1.138) & (0.263) & (0.176) & (0.388) \\ 
& & & & & & \\ 
Log Household Income & -8.409 & -6.143 & -2.835 & -3.038 & -4.194^{**} 
& 2.595 \\ 
& (7.133) & (4.947) & (9.834) & (3.159) & (2.120) & (3.570) \\ 
& & & & & & \\ 
Work Minutes & -0.424^{***} & -0.227^{***} & -0.275^{***} & 
-0.106^{***} & -0.062^{***} & -0.084^{***} \\ 
& (0.018) & (0.012) & (0.024) & (0.009) & (0.006) & (0.010) \\ 
& & & & & & \\ 
Child 0-5 & 172.346^{***} & -5.395 & 112.881^{***} & 34.885^{***} & 
0.746 & 19.181^{***} \\ 
& (10.328) & (7.163) & (11.468) & (4.545) & (3.050) & (4.082) \\ 
& & & & & & \\ 
Child 6-18 & 44.392^{***} & 30.974^{***} &  & 7.323^{**} & 3.750 &  \\ 
& (8.366) & (5.803) &  & (3.704) & (2.485) &  \\ 
& & & & & & \\ 
High School & 14.358 & 11.918 & 13.574 & 2.479 & 0.665 & -1.509 \\ 
& (14.103) & (9.782) & (35.007) & (6.961) & (4.671) & (12.953) \\ 
& & & & & & \\ 
College & 11.746 & 1.660 & 26.062 & 6.437 & 1.397 & -1.739 \\ 
& (15.879) & (11.014) & (36.345) & (7.461) & (5.006) & (13.706) \\ 
& & & & & & \\ 
Spouse High School & 0.735 & -3.638 & 9.136 & -1.743 & 1.624 & -4.717 
\\ 
& (10.900) & (7.561) & (16.345) & (4.476) & (3.003) & (5.476) \\ 
& & & & & & \\ 
Spouse College & -2.203 & -2.939 & -6.558 & 2.470 & 2.046 & -2.122 \\ 
& (10.975) & (7.612) & (13.023) & (4.639) & (3.113) & (4.364) \\ 
& & & & & & \\ 
\hline \\[-1.8ex] 
Observations & \multicolumn{1}{c}{1,538} & \multicolumn{1}{c}{1,538} & 
\multicolumn{1}{c}{1,013} & \multicolumn{1}{c}{1,539} & 
\multicolumn{1}{c}{1,539} & \multicolumn{1}{c}{1,014} \\ 
R$^{2}$ & \multicolumn{1}{c}{0.546} & \multicolumn{1}{c}{0.314} & 
\multicolumn{1}{c}{0.367} & \multicolumn{1}{c}{0.178} & 
\multicolumn{1}{c}{0.112} & \multicolumn{1}{c}{0.155} \\ 
Adjusted R$^{2}$ & \multicolumn{1}{c}{0.543} & \multicolumn{1}{c} 
{0.309} & \multicolumn{1}{c}{0.361} & \multicolumn{1}{c}{0.173} & 
\multicolumn{1}{c}{0.106} & \multicolumn{1}{c}{0.147} \\ 
Residual Std. Error & \multicolumn{1}{c}{146.365 (df = 1526)} & 
\multicolumn{1}{c}{101.519 (df = 1526)} & \multicolumn{1}{c}{144.965 
(df = 1002)} & \multicolumn{1}{c}{65.110 (df = 1527)} & 
\multicolumn{1}{c}{43.686 (df = 1527)} & \multicolumn{1}{c}{52.256 (df 
= 1003)} \\ 
\hline 
\hline \\[-1.8ex] 
\textit{Note:}  & \multicolumn{6}{r}{$^{*}$p$<$0.1; $^{**}$p$<$0.05; 
$^{***}$p$<$0.01} \\ 
\end{tabular}} 
\end{table}
\end{landscape}

表格1

答案1

错位的原因在于&之间\cline{2-4} & \cline{4-6}

此外,不要\\在 后面放置\hline,并且不需要空行来在行之间创建间隙。

但是,可以使用以下方法改善表格的外观booktabs包裹及其规则。

你有很多空白的地方,我用过makecell将标题放入更多行并腾出空间。

您会在代码注释中找到其他建议。

\documentclass{article}
\usepackage{rotating}
\usepackage{array}
\usepackage{booktabs}
\usepackage{makecell}
\usepackage{dcolumn}
\newcolumntype{C}{D{.}{.}{-3}}
\usepackage{pdflscape}
\usepackage{caption}

\begin{document}
\begin{sidewaystable}% I suspect you need a sidewaystable instead of a landscape
    \centering\scriptsize% instead of resizing, choose an appropriate fontsize
    \caption{Household Production Minutes: Full Sample\label{tab:min}}  
        \begin{tabular}{l*6C} 
            \toprule 
            & \multicolumn{3}{c}{\textit{Female:}} & \multicolumn{3}{c}{\textit{Male:}} \\
            \cmidrule(r){2-4}\cmidrule(l){5-7}
             & \multicolumn{1}{c}{\makecell{Total\\ Household\\ Production}} & 
            \multicolumn{1}{c}{\makecell{Chore\\ Minutes}} & \multicolumn{1}{c}{\makecell{Parenting\\ Minutes}} & \multicolumn{1}{c}{\makecell{Total\\ Household\\ Production}} & 
            \multicolumn{1}{c}{\makecell{Chore\\ Minutes}} & \multicolumn{1}{c}{\makecell{Parenting\\ Minutes}} \\ 
             & \multicolumn{1}{c}{(1)} & \multicolumn{1}{c}{(2)} & 
            \multicolumn{1}{c}{(3)} & \multicolumn{1}{c}{(4)} & \multicolumn{1}{c} 
            {(5)} & \multicolumn{1}{c}{(6)}\\ 
            \midrule 
            Income Share & -11.280 & -44.380^{***} & 54.654^{**} & -27.438^{***} & 
            -23.011^{***} & -7.523 \\ 
            & (17.360) & (12.041) & (25.994) & (6.601) & (4.429) & (7.563) \\[4pt] % instead of an empy row, add a little gap between the lines
            Education Difference & -6.791 & -1.060 & -12.021^{*} & -2.431 & -2.362 
            & 1.915 \\
            & (4.760) & (3.302) & (6.788) & (2.147) & (1.440) & (2.409) \\[4pt]  
            Age & -1.541^{**} & 1.218^{***} & -5.477^{***} & -0.823^{***} & 0.022 
            & -1.812^{***} \\ 
            & (0.604) & (0.419) & (1.138) & (0.263) & (0.176) & (0.388) \\[4pt] 
            Log Household Income & -8.409 & -6.143 & -2.835 & -3.038 & -4.194^{**} 
            & 2.595 \\ 
            & (7.133) & (4.947) & (9.834) & (3.159) & (2.120) & (3.570) \\[4pt] 
            Work Minutes & -0.424^{***} & -0.227^{***} & -0.275^{***} & 
            -0.106^{***} & -0.062^{***} & -0.084^{***} \\ 
            & (0.018) & (0.012) & (0.024) & (0.009) & (0.006) & (0.010) \\[4pt] 
            Child 0-5 & 172.346^{***} & -5.395 & 112.881^{***} & 34.885^{***} & 
            0.746 & 19.181^{***} \\ 
            & (10.328) & (7.163) & (11.468) & (4.545) & (3.050) & (4.082) \\[4pt] 
            Child 6-18 & 44.392^{***} & 30.974^{***} &  & 7.323^{**} & 3.750 &  \\ 
            & (8.366) & (5.803) &  & (3.704) & (2.485) &  \\[4pt] 
            High School & 14.358 & 11.918 & 13.574 & 2.479 & 0.665 & -1.509 \\ 
            & (14.103) & (9.782) & (35.007) & (6.961) & (4.671) & (12.953) \\[4pt] 
            College & 11.746 & 1.660 & 26.062 & 6.437 & 1.397 & -1.739 \\ 
            & (15.879) & (11.014) & (36.345) & (7.461) & (5.006) & (13.706) \\[4pt] 
            Spouse High School & 0.735 & -3.638 & 9.136 & -1.743 & 1.624 & -4.717 
            \\ 
            & (10.900) & (7.561) & (16.345) & (4.476) & (3.003) & (5.476) \\[4pt] 
            Spouse College & -2.203 & -2.939 & -6.558 & 2.470 & 2.046 & -2.122 \\ 
            & (10.975) & (7.612) & (13.023) & (4.639) & (3.113) & (4.364) \\ 
            \midrule 
            Observations & \multicolumn{1}{c}{1,538} & \multicolumn{1}{c}{1,538} & 
            \multicolumn{1}{c}{1,013} & \multicolumn{1}{c}{1,539} & 
            \multicolumn{1}{c}{1,539} & \multicolumn{1}{c}{1,014} \\ 
            R$^{2}$ & \multicolumn{1}{c}{0.546} & \multicolumn{1}{c}{0.314} & 
            \multicolumn{1}{c}{0.367} & \multicolumn{1}{c}{0.178} & 
            \multicolumn{1}{c}{0.112} & \multicolumn{1}{c}{0.155} \\ 
            Adjusted R$^{2}$ & \multicolumn{1}{c}{0.543} & \multicolumn{1}{c} 
            {0.309} & \multicolumn{1}{c}{0.361} & \multicolumn{1}{c}{0.173} & 
            \multicolumn{1}{c}{0.106} & \multicolumn{1}{c}{0.147} \\ 
            Residual Std. Error & \multicolumn{1}{c}{146.365} & % I divided the original line into two to avoid repetition, of course I don't know if it is correct in your case
            \multicolumn{1}{c}{101.519} & \multicolumn{1}{c}{144.965} & \multicolumn{1}{c}{65.110} & 
            \multicolumn{1}{c}{43.686} & \multicolumn{1}{c}{52.256} \\
            (df) & \multicolumn{1}{c}{(1526)} & 
        \multicolumn{1}{c}{(1526)} & \multicolumn{1}{c}{(1002)} & \multicolumn{1}{c}{(1527)} & 
    \multicolumn{1}{c}{(1527)} & \multicolumn{1}{c}{(1003)} \\
            \bottomrule 
             \multicolumn{7}{l}% here, of course, you can choose also r
             {\textit{Note:}$^{\strut*}$% added \strut to put a little gap between the rule and the not
                p$<$0.1;$^{**}$p$<$0.05;$^{***}$p$<$0.01} \\ 
    \end{tabular} 
\end{sidewaystable}
\end{document}

在此处输入图片描述

答案2

另一种方法是使用siunitxthreeparttablex包,用于表格环境,tabular*它能够@{\extracolsep{\fill}}自动确定\tabcolsep并能够使用正常字体大小(大多与主题无关,但可以帮助美化表格):

\documentclass{article}
\usepackage{geometry}
\usepackage{rotating}
\usepackage{booktabs, makecell}
\usepackage[referable]{threeparttablex}
\usepackage{siunitx}
\usepackage[skip=1ex]{caption}

\begin{document}
    \begin{sidewaystable}
    \centering
    \sisetup{input-symbols = {( - )},
             table-space-text-post=***,
             }
    \renewcommand\arraystretch{0.9}
    \setlength\tabcolsep{0pt}
\begin{threeparttable}
\caption{Household Production Minutes: Full Sample}
\label{tab:min}
\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}
                    l
               *{6}{S[table-format=3.3]}
                                        }
    \toprule
    &   \multicolumn{3}{c}{\textit{Female:}}
                    &   \multicolumn{3}{c}{\textit{Male:}}  \\
    \cmidrule{2-4}\cmidrule{5-7}
    & {\makecell[b]{Total\\ Household\\ Production}}
        & {\makecell[b]{Chore\\ Minutes}}
            & {\makecell[b]{Parenting\\ Minutes}}
                & {\makecell[b]{Total\\ Household\\ Production}}
                    & {\makecell[b]{Chore\\ Minutes}}
                        & {\makecell[b]{Parenting\\ Minutes}}  \\
     & {(1)} & {(2)} & {(3)} & {(4)} & {(5)} & {(6)}        \\
    \midrule
Income Share
    & -11.280           & -44.380\tnote{***}& 54.654\tnote{**}
    & -27.438\tnote{***}& -23.011\tnote{***}& -7.523        \\
    & (17.360)          & (12.041)          & (25.994)
    & (6.601)           & (4.429)           & (7.563)       \\
    \addlinespace
Education Difference
    & -6.791            & -1.060            & -12.021\tnote{*}
    & -2.431            & -2.362            & 1.915         \\
    & (4.760)           & (3.302)           & (6.788)
    & (2.147)           & (1.440)           & (2.409)       \\
    \addlinespace
Age & -1.541\tnote{**}  & 1.218\tnote{***}  & -5.477\tnote{***}
    & -0.823\tnote{***} & 0.022             & -1.812\tnote{***}  \\
    & (0.604)           & (0.419)           & (1.138)
    & (0.263)           & (0.176)           & (0.388)       \\
    \addlinespace
Log Household Income
    & -8.409            & -6.143            & -2.835
    & -3.038            & -4.194\tnote{**}  & 2.595         \\
    & (7.133)           & (4.947)           & (9.834)
    & (3.159)           & (2.120)           & (3.570)       \\
    \addlinespace
Work Minutes
    & -0.424\tnote{***} & -0.227\tnote{***} & -0.275\tnote{***}
    & -0.106\tnote{***} & -0.062\tnote{***} & -0.084\tnote{***}  \\
    & (0.018)           & (0.012)           & (0.024)
    & (0.009)           & (0.006)           & (0.010)       \\
    \addlinespace
Child 0-5
    & 172.346\tnote{***}& -5.395            & 112.881\tnote{***}
    & 34.885\tnote{***} & 0.746             & 19.181\tnote{***}  \\
    & (10.328)          & (7.163)           & (11.468)
    & (4.545)           & (3.050)           & (4.082)       \\
    \addlinespace
Child 6-18
    & 44.392\tnote{***} & 30.974\tnote{***} &
    & 7.323\tnote{**}   & 3.750             &               \\
    & (8.366)           & (5.803)           &
    & (3.704)           & (2.485)           &               \\
    \addlinespace
High School
    & 14.358            & 11.918            & 13.574
    & 2.479             & 0.665             & -1.509        \\
    & (14.103)          & (9.782)           & (35.007)
    & (6.961)           & (4.671)           & (12.953)      \\
    \addlinespace
College
    & 11.746            & 1.660             & 26.062
    & 6.437             & 1.397             & -1.739        \\
    & (15.879)          & (11.014)          & (36.345)
    & (7.461)           & (5.006)           & (13.706)      \\
    \addlinespace
Spouse High School
    & 0.735             & -3.638            & 9.136
    & -1.743            & 1.624             & -4.717        \\
    & (10.900)          & (7.561)           & (16.345)
    & (4.476)           & (3.003)           & (5.476)       \\
    \addlinespace
Spouse College
    & -2.203            & -2.939            & -6.558
    & 2.470             & 2.046             & -2.122        \\
    & (10.975)          & (7.612)           & (13.023)
    & (4.639)           & (3.113)           & (4.364)       \\
    \midrule
Observations
    & {1,538}           & {1,538}           & {1,013}
    & {1,539}           & {1,539}           & {1,014}       \\
R$\tnote{2}$
    & {0.546}           & {0.314}           & {0.367}
    & {0.178}           & {0.112}           & {0.155}       \\
Adjusted R$\tnote{2}$
    & {0.543}           & {0.309}           & {0.361} 
    & {0.173}           & {0.106}           & {0.147}       \\
Residual Std. Error
    & 146.365           & 101.519           & 144.965
    & 65.110            & 43.686            & 52.256        \\
(df)& {(1,526)}         & {(1,526)}         & {(1,002)}
    & {(1,527)}         & {(1,527)}         & {(1,003)}     \\
    \bottomrule
    \end{tabular*}
    \begin{tablenotes}[flushleft, para]\footnotesize
\note: \item[*] $p<$0.1; \item[**] $p<0.05$; \item[***] $p<0.01$
    \end{tablenotes}
\end{threeparttable}
    \end{sidewaystable}
\end{document}

结果:

在此处输入图片描述

相关内容