统计表太大

统计表太大

我想在一张表中显示一些统计数据和各治疗组的均值差异。数据是从 stata 导出的。我想为第一列的变量名称分配更多空间,以便表格看起来更美观,并降低均值和标准差数字/线之间的空间。

统计表的编码方式如下:

\documentclass{article} 
\usepackage[margin=1in]{geometry}

\usepackage{booktabs} % For better looking tables
\usepackage{tabularx}

\setlength{\parindent}{0pt}


\newcommand{\sym}[1]{#1}

\newcommand{\fignote}[1]{\figtext{\emph{Note:~}~#1}}

\newcommand{\figsource}[1]{\figtext{\emph{Source:~}~#1}}

\usepackage{siunitx} % centering in tables
    \sisetup{
        detect-mode,
        tight-spacing       = true,
        group-digits        = false ,
        %input-signs     = ,
        %input-symbols       = ( ) [ ]  + *,
        input-open-uncertainty  = ,
        input-close-uncertainty = ,
        table-align-text-post   = false
        }
        
\usepackage{makecell}
\renewcommand{\theadfont}{\normalsize}

\usepackage{enumitem}
\newlist{myitemize}{itemize}{1}
\setlist[myitemize]{nosep, 
                    left=0pt,
                    before=\begin{minipage}{\linewidth},
                    after =\end{minipage}, 
                    label=--}

\usepackage[colorlinks,%
citecolor=black,
filecolor=black,%
linkcolor=black,%
urlcolor=black]{hyperref} % for linking between references, figures, TOC, etc in the pdf document

\begin{document}

\begin{table}[h!]
  \sisetup{table-format=-1.3,
           table-space-text-pre=),
           table-space-text-post=)***,
           table-align-text-pre=false,
           table-align-text-post=false}
           \setlength{\tabcolsep}{3pt}
    \caption{Summary Statistics at Baseline} \label{table}
    \begin{tabularx}{\textwidth}{>{\raggedright\arraybackslash}X*{7}{S}}
\toprule
\cmidrule{2-8}
     &\multicolumn{4}{c}{Total average}
       &\multicolumn{3}{c}{\thead{Difference in means}}
        \\
\cmidrule(lr){2-5}\cmidrule(lr){6-8} 
  &{Total} &{Control} &{Classroom} &{Individualized} &{(C)-(CR)}  &{(C)-(I)}     &{(CR)-(I)}    \\
  % insert after midrule until bottomrule
\midrule


Age \scriptsize (years)        
&  23.6 &  23.3 & 23.8 &  23.7 & -0.50  &  -0.32 &  0.18         \\
&  (4.16) & (3.75) & (4.43) & (4.30) & (0.38) & (0.37) & (0.41)         \\
                      \\


Marital Status \scriptsize  (0, single ; \scriptsize  1, married) 
& 0.047 & 0.033 & 0.066 & 0.043 & -0.032  & -0.0094 & 0.023         \\
& (0.21)  &  (0.18) & (0.25)&  (0.20)& (0.020)  & (0.018)  &  (0.021)         \\
\\

Language \scriptsize  (0, Non-Odia ; \scriptsize  1, Odia)  
&  0.50 & 0.49 & 0.46 & 0.55 & 0.027 & -0.055 & -0.082\sym{*}  \\
&  (0.50) & (0.50)& (0.50)& (0.50)& (0.046) & (0.046) &  (0.046)  \\
\\

Remittance dummy \scriptsize (0, not remitting; \scriptsize 1, remitting) 
&  0.86 &  0.85 &  0.85 & 0.89 & 0.0033 & -0.035 & -0.038 \\
& (0.34) & (0.35) & (0.36) & (0.31) & (0.033) & (0.031) & (0.031)  \\
\\

Awareness of digital payment method \scriptsize (1, have heard about digital payment methods) 
& 0.63 & 0.62 & 0.60 & 0.67 & 0.019 & -0.054 & -0.074 \\
& (0.48) & (0.49) & (0.49) & (0.47) & (0.045) & (0.044) & (0.045) \\

Use of digital payment methods \scriptsize (0, not using; \scriptsize1, using)
& 0.057 & 0.054 & 0.048 & 0.068 & 0.0059 & -0.014 &  -0.020         \\
& (0.23) & (0.23) & (0.21) & (0.25) & (0.020) & (0.022) &  (0.022)         \scriptsize
\\

Quantity remitted in the past 30 days \scriptsize (in INR)
&      3719.1                    &      3560.4&                          3848.7&                          3755.6&                                    -288.3         &                 -195.1                    &        93.1         \\

 &    (3769.1)                     &    (3101.7)                    &    (4574.2)&                         (3527.6)&                       (363.1)           &     (305.4)         &     (380.7)         \\
 
 \\
 
Remittance fees \scriptsize(in INR)
&        60.2&                       58.1&                     &        64.9&                         57.9&                      -6.77         &                  0.25         &               7.02         \\
                 
                  
&      (64.6)               &      (50.2)                   &      (88.9)&                        (48.4)&                         (7.30)         &               (4.86)         &                (7.23)         \\

\\

Stress index        
& 0.000000011                    &      -0.077                   &      -0.019&                        0.097&                        -0.058         &       -0.17\sym{*}  &                  -0.12         \\
                   
 &      (1.00)&    (0.98)&                         (0.98)&                 (1.03)&                         (0.092)        &     (0.093)              &     (0.094)         \\
 
 \\
 
Aware of bank balance \scriptsize(0, not tracking their bank balance; \scriptsize 1 tracking tracking)
&        0.68                    &        0.67 &        0.66 &        0.70&                       0.0060        &      -0.036         &      -0.042         \\

                    &      (0.47) &      (0.47)&                     &      (0.47)&                    (0.46)&                       (0.045)         &               (0.044)             &     (0.044)         \\
                    \\
                    
Ease of coming up with 4000INR for an emergency \scriptsize(between 0 and 2)
&        0.98         &        0.99 &           1 &        0.94&  -0.012         &             0.047      &       0.060         \\

&      (0.65)&  (0.62)&   (0.66)&  (0.67)&   (0.059)  &     (0.059)        &     (0.062)         \\
                    
\midrule
Number of observations&         702            &         240          &         228&                           234&                           468                 &         474             &         462                    \\
  % end inserting after midrule until bottomrule

\bottomrule
\end{tabularx}
Notes: 

\begin{myitemize}
\item All variables were collected during the baseline survey cycle. \\
\item The table includes all workers interviewed at baseline, including attrited participants. 
\item The three last columns display the differences in the means across the experimental groups. 
\item ***, **, and * indicate significance at the 1\%, 5\%, and 10\% critical level. \item The stress index is an indicator variable created using a weighted average of three indicator variables (stress related to consumption, stress related to remittance, and overall financial stress). The index is a z-score unit, with higher values corresponding to "positive" outcomes, , i.e. lower levels of stress.
\item The emergency variable is on a Likert scale from 0  to 2; respectively from "very difficult, or not possible", "possible, but not easy", to "quite easy". A high variable corresponds to a "positive" outcome, i.e. a better ability to come up with 4000 INR if necessary..
\end{myitemize}
\end{table}

您是否知道如何将此表(包括脚注)放入一页中,以及如何调整第一列的大小?

提前致以最诚挚的问候,Raphaëlle Aulagnon

答案1

为了减少标题行和左侧列的混乱,我将使用包threeparttable、其\tnote宏和tablenotes环境。为了节省后一个环境中的空间,我将使用包的para(“段落模式”)选项。我还会设置并使用宏(见下文)以更紧凑地排版第一列中的材料。我将在列类型的默认定义中将\mytab选项更改为table-space-text-post=)***。最后但并非最不重要的是,我将摆脱两个似是而非的标记,它们会弄乱 7 个数据列中数字的对齐。table-space-text-post=)**S&

在此处输入图片描述

\documentclass{article} 
\usepackage[margin=1in]{geometry}

\usepackage{booktabs} % For better looking tables
\usepackage{tabularx}
\setlength{\parindent}{0pt}
\newcommand{\sym}[1]{#1}
\newcommand{\fignote}[1]{\figtext{\emph{Note:~}~#1}}
\newcommand{\figsource}[1]{\figtext{\emph{Source:~}~#1}}

\usepackage{siunitx} % centering in tables
 \sisetup{
 detect-mode,
 tight-spacing  = true,
 group-digits = false ,
 %input-signs  = ,
 %input-symbols  = ( ) [ ]  + *,
 input-open-uncertainty  = ,
 input-close-uncertainty = ,
 table-align-text-post   = false
 }
\usepackage{ragged2e}
\usepackage[para,flushleft]{threeparttable}
\renewcommand\TPTtagStyle{\textsf}

\usepackage{enumitem}
\newlist{myitemize}{itemize}{1}
\setlist[myitemize]{noitemsep,left=0pt,label=--}

\usepackage[colorlinks,allcolors=black]{hyperref} 

\newcolumntype{P}{>{\RaggedRight\hspace{0pt}}p{\hsize}}
\newcommand\mytab[1]{\smash{%
   \begin{tabular}[t]{@{} P @{}} #1 \end{tabular}}}


\begin{document}

\begin{table}[p] % place table on a page by itself
\sisetup{table-format=1.3,
    table-space-text-pre=(,
    table-space-text-post=)**, % not: table-space-text-post=)***,
    table-align-text-pre=false,
    table-align-text-post=false}
\setlength{\tabcolsep}{3pt}
\begin{threeparttable}
  \caption{Summary Statistics at Baseline} 
  \label{table}
  \begin{tabularx}{\textwidth}{@{} >{\RaggedRight\hspace{0pt}}X *{7}{S} @{}}
\toprule
%%%\cmidrule{2-8}
  &\multicolumn{4}{c}{Total average}
  &\multicolumn{3}{c@{}}{Difference in means} \\
  \cmidrule(lr){2-5}\cmidrule(l){6-8} 
  &{Total} &{C\tnote{1}} &{CR\tnote{2}} &{I\tnote{3}} 
  &{(C)$-$(CR)}  &{(C)$-$(I)}  &{(CR)$-$(I)} \\
  % insert after midrule until bottomrule  % what does this mean?
\midrule

Age \scriptsize (years) 
&  23.6 &  23.3 & 23.8 &  23.7 & -0.50  &  -0.32 &  0.18  \\
&  (4.16) & (3.75) & (4.43) & (4.30) & (0.38) & (0.37) & (0.41)  \\
\addlinespace
Marital Status\tnote{a} 
& 0.047 & 0.033 & 0.066 & 0.043 & -0.032  & -0.0094 & 0.023  \\
& (0.21)  &  (0.18) & (0.25)&  (0.20)& (0.020)  & (0.018) & (0.021)  \\
\addlinespace
Language\tnote{b}
&  0.50 & 0.49 & 0.46 & 0.55 & 0.027 & -0.055 & -0.082\sym{*}  \\
&  (0.50) & (0.50)& (0.50)& (0.50)& (0.046) & (0.046) &  (0.046)  \\
\addlinespace
Remittance dummy\tnote{c}
&  0.86 &  0.85 &  0.85 & 0.89 & 0.0033 & -0.035 & -0.038 \\
& (0.34) & (0.35) & (0.36) & (0.31) & (0.033) & (0.031) & (0.031)  \\
\addlinespace
\mytab{Awareness of digital payment method\tnote{d}}
& 0.63 & 0.62 & 0.60 & 0.67 & 0.019 & -0.054 & -0.074 \\
& (0.48) & (0.49) & (0.49) & (0.47) & (0.045) & (0.044) & (0.045) \\
\addlinespace
\mytab{Use of digital payment methods\tnote{e}}
& 0.057 & 0.054 & 0.048 & 0.068 & 0.0059 & -0.014 &  -0.020  \\
& (0.23) & (0.23) & (0.21) & (0.25) & (0.020) & (0.022) &  (0.022)\\
\addlinespace
\mytab{Quantity remitted in past 30 days\tnote{f}}
& {3719.1} & {3560.4} & {3848.7} & {3755.6} &  {$-288.3$} & {$-195.1$} & 93.1 \\
& {(3769.1)} & {(3101.7)} & {(4574.2)}& {(3527.6)}&{(363.1)} & {(305.4)} &(380.7)  \\
\addlinespace
Remittance fees\tnote{g} 
& 60.2& 58.1& 64.9& 57.9& -6.77  & 0.25  & 7.02  \\
& (64.6) & (50.2) & (88.9)& (48.4)& (7.30)  & (4.86)  & (7.23)  \\
\addlinespace
Stress index 
& {\num[tight-spacing]{1.1e-10}} & -0.077 & -0.019& 0.097& -0.058 & -0.17\sym{*} & -0.12 \\
& (1.00)& (0.98)& (0.98)& (1.03)& (0.092) &  (0.093) &  (0.094)  \\
\addlinespace
\mytab{Aware of bank balance\tnote{h}}
& 0.68 & 0.67 & 0.66 & 0.70& 0.0060 & -0.036  & -0.042  \\
& (0.47) & (0.47)& (0.47)& (0.46)& (0.045) & (0.044) & (0.044)  \\
\addlinespace
\mytab{Ease of coming up with 4000INR for an emergency\tnote{i}}
& 0.98  & 0.99 &  1 & 0.94&  -0.012  &  0.047 &  0.060  \\
& (0.65)&  (0.62)&   (0.66)&  (0.67)&   (0.059)  &  (0.059) &  (0.062)  \\
\midrule
Number of obs.& {702} & {240} & {228} & {234} & {468} & {474} & {462} \\
% end inserting after midrule until bottomrule
\bottomrule
\end{tabularx}
\medskip
\begin{tablenotes}
\footnotesize
\item[1] C: Control
\item[2] CR: Classroom
\item[3] I: Individualized
\item[a] 0, single; 1, married
\item[b] 0, Non-Odia; 1, Odia  
\item[c] 0, not remitting; 1, remitting 
\item[d] 1, have heard about digital payment methods 
\item[e] 0, not using; 1, using
\item[f] in INR
\item[g] in INR
\item[h] 0, not tracking their bank balance; 1 tracking
\item[i] between 0 and 2
\end{tablenotes}
\end{threeparttable}

\bigskip\small
Notes: 
\begin{myitemize}
\item All variables were collected during the baseline survey cycle.
\item The table includes all workers interviewed at baseline, including attrited participants. 
\item The three last columns display the differences in the means across the experimental groups. 
\item ***, **, and * indicate significance at the 1\%, 5\%, and 10\% critical level. \item The stress index is an indicator variable created using a weighted average of three indicator variables (stress related to consumption, stress related to remittance, and overall financial stress). The index is a z-score unit, with higher values corresponding to ``positive'' outcomes, , i.e. lower levels of stress.
\item The emergency variable is on a Likert scale from 0  to 2; respectively from ``very difficult, or not possible'', ``possible, but not easy'', to ``quite easy''. A high variable corresponds to a ``positive'' outcome, i.e. a better ability to come up with 4000 INR if necessary.
\end{myitemize}
\end{table}
\end{document}

答案2

以下内容可作为起点:

在此处输入图片描述

\documentclass{article} 
\usepackage[margin=1in]{geometry}

\usepackage{booktabs} % For better looking tables
\usepackage{tabularx}

\setlength{\parindent}{0pt}

\newcommand{\sym}[1]{#1}

\newcommand{\fignote}[1]{\figtext{\emph{Note:~}~#1}}

\newcommand{\figsource}[1]{\figtext{\emph{Source:~}~#1}}

\usepackage{siunitx} % centering in tables
    \sisetup{
        detect-mode,
        tight-spacing       = true,
        group-digits        = false ,
        %input-signs     = ,
        %input-symbols       = ( ) [ ]  + *,
        input-open-uncertainty  = ,
        input-close-uncertainty = ,
        table-align-text-post   = false
        }
        
\usepackage{makecell}
\renewcommand{\theadfont}{\normalsize}

\usepackage{enumitem}
\newlist{myitemize}{itemize}{1}
\setlist[myitemize]{nosep, 
                    left=0pt,
                    before=\begin{minipage}{\linewidth},
                    after =\end{minipage}, 
                    label=--}
\usepackage{pdflscape}
\usepackage{multirow}

\usepackage[colorlinks,%
citecolor=black,
filecolor=black,%
linkcolor=black,%
urlcolor=black]{hyperref} % for linking between references, figures, TOC, etc in the pdf document

\begin{document}
%\begin{landscape}
\begin{table}[h!]
\small
  \sisetup{table-format=-4.3,
           table-space-text-pre=),
           table-space-text-post=),
           table-align-text-pre=false,
           table-align-text-post=false}
           \setlength{\tabcolsep}{1pt}
    \caption{Summary Statistics at Baseline} \label{table}
    \begin{tabularx}{\linewidth}{>{\raggedright\arraybackslash}X
                                 S[table-format=4.9]
                                 *{4}{S}
                                 *{2}{S[table-space-text-post=*]}}
\toprule
     &\multicolumn{4}{c}{Total average}
       &\multicolumn{3}{c}{Difference in means}
        \\
\cmidrule(lr){2-5}\cmidrule(lr){6-8} 
  &{Total} &{C} &{CR} &{I} &{(C)-(CR)}  &{(C)-(I)}     &{(CR)-(I)}    \\
  % insert after midrule until bottomrule
\midrule


Age \scriptsize (years)        
&  23.6 &  23.3 & 23.8 &  23.7 & -0.50  &  -0.32 &  0.18         \\
&  (4.16) & (3.75) & (4.43) & (4.30) & (0.38) & (0.37) & (0.41)         \\
                     \addlinespace


\multirow[t]{2}{=}{Marital Status \scriptsize  (0, single ; \scriptsize  1, married)} 
& 0.047 & 0.033 & 0.066 & 0.043 & -0.032  & -0.0094 & 0.023         \\
& (0.21)  &  (0.18) & (0.25)&  (0.20)& (0.020)  & (0.018)  &  (0.021)         \\
\addlinespace


\multirow[t]{2}{=}{Language \scriptsize  (0, Non-Odia ; \scriptsize  1, Odia)}  
&  0.50 & 0.49 & 0.46 & 0.55 & 0.027 & -0.055 & -0.082\sym{*}  \\
&  (0.50) & (0.50)& (0.50)& (0.50)& (0.046) & (0.046) &  (0.046)  \\
\addlinespace


\multirow[t]{3}{=}{Remittance dummy \scriptsize (0, not remitting; \scriptsize 1, remitting)} 
&  0.86 &  0.85 &  0.85 & 0.89 & 0.0033 & -0.035 & -0.038 \\
& (0.34) & (0.35) & (0.36) & (0.31) & (0.033) & (0.031) & (0.031)  \\
\\ \addlinespace


\multirow[t]{5}{=}{Awareness of digital payment method \scriptsize (1, have heard about digital payment methods)} 
& 0.63 & 0.62 & 0.60 & 0.67 & 0.019 & -0.054 & -0.074 \\
& (0.48) & (0.49) & (0.49) & (0.47) & (0.045) & (0.044) & (0.045) \\
\\
\\
\\ 

\multirow[t]{3}{=}{Use of digital payment methods \scriptsize (0, not using; \scriptsize1, using)}
& 0.057 & 0.054 & 0.048 & 0.068 & 0.0059 & -0.014 &  -0.020         \\
& (0.23) & (0.23) & (0.21) & (0.25) & (0.020) & (0.022) &  (0.022)         
\\
\\

\multirow[t]{3}{=}{Quantity remitted in the past 30 days \scriptsize (in INR)}
&      3719.1                    &      3560.4&                          3848.7&                          3755.6&                                    -288.3         &                 -195.1                    &        93.1         \\

 &    (3769.1)                     &    (3101.7)                    &    (4574.2)&                         (3527.6)&                       (363.1)           &     (305.4)         &     (380.7)         \\
 \\
\addlinespace

 
\multirow[t]{2}{=}{Remittance fees \scriptsize(in INR)}
&        60.2&                       58.1&                             64.9&                         57.9&                      -6.77         &                  0.25         &               7.02         \\
                 
                  
&      (64.6)               &      (50.2)                   &      (88.9)&                        (48.4)&                         (7.30)         &               (4.86)         &                (7.23)         \\

\addlinespace


Stress index        
& 0.000000011                    &      -0.077                   &      -0.019&                        0.097&                        -0.058         &       -0.17\sym{*}  &                  -0.12         \\
                   
 &      (1.00)&    (0.98)&                         (0.98)&                 (1.03)&                         (0.092)        &     (0.093)              &     (0.094)         \\
 
\addlinespace

 
\multirow[t]{5}{=}{Aware of bank balance \scriptsize(0, not tracking their bank balance; \scriptsize 1 tracking tracking)}
&        0.68                    &        0.67 &        0.66 &        0.70&                       0.0060        &      -0.036         &      -0.042         \\

                    &      (0.47) &      (0.47)&                           (0.47)&                    (0.46)&                       (0.045)         &               (0.044)             &     (0.044)         \\
                    \\ \\
                    \addlinespace
                    
\multirow[t]{4}{=}{Ease of coming up with 4000INR for an emergency \scriptsize(between 0 and 2)}
&        0.98         &        0.99 &           1 &        0.94&  -0.012         &             0.047      &       0.060         \\

&      (0.65)&  (0.62)&   (0.66)&  (0.67)&   (0.059)  &     (0.059)        &     (0.062)         \\
\\
\\
                    
\midrule
Number of observations&         702            &         240          &         228&                           234&                           468                 &         474             &         462                    \\
  % end inserting after midrule until bottomrule

\bottomrule
\end{tabularx}
Notes: 

\begin{myitemize}
\item All variables were collected during the baseline survey cycle. 
\item C = Control, CR = Classroom, I = Individualized
\item The table includes all workers interviewed at baseline, including attrited participants. 
\item The three last columns display the differences in the means across the experimental groups. 
\item ***, **, and * indicate significance at the 1\%, 5\%, and 10\% critical level. \item The stress index is an indicator variable created using a weighted average of three indicator variables (stress related to consumption, stress related to remittance, and overall financial stress). The index is a z-score unit, with higher values corresponding to "positive" outcomes, , i.e. lower levels of stress.
\item The emergency variable is on a Likert scale from 0  to 2; respectively from "very difficult, or not possible", "possible, but not easy", to "quite easy". A high variable corresponds to a "positive" outcome, i.e. a better ability to come up with 4000 INR if necessary..
\end{myitemize}
\end{table}
%\end{landscape}
\end{document}

相关内容