Brauchen Sie bitte Hilfe beim Formatieren einer Tabelle (mehrere Spalten)

Brauchen Sie bitte Hilfe beim Formatieren einer Tabelle (mehrere Spalten)

Ich bin ein Student im letzten Jahr der Politikwissenschaft, aber ein Anfänger im LaTeX-Satz. Bitte verzeihen Sie mir, wenn ich dumm klinge.

Ich formatierte eine Tabelle für die Darstellung meiner Erkenntnisse aus einer von mir durchgeführten Regressionsanalyse. Ich brauche bitte Hilfe beim Ausrichten der Beschreibungszellen mit den dargestellten Ergebnissen.

Hier ist beispielsweise die Tabellenausgabe, die ich gerade habe:

Bildbeschreibung hier eingeben

Wie Sie sehen, sind beispielsweise die Zellen in den Spalten 2, 3 und 4 nicht korrekt mit der Beschreibung in Spalte 1 ausgerichtet. Es gibt eine starke Verzerrung nach oben und unten, die ich unbedingt korrigieren möchte.

Hier ist der Code, den ich derzeit verwende. Ich wäre sehr dankbar, wenn mir jemand den Code selbst erklären könnte.

\begin{tabular}{@{}llll@{}}
\multicolumn{4}{c}{\textbf{\begin{tabular}[c]{@{}c@{}}Table 3. OLS (Ordinary Least Square) Regression Analysis Between \\ Development Indicators\\ And Infant Mortality Rate In India\end{tabular}}} \\ \midrule
\multicolumn{1}{c}{\multirow{2}{*}{Independent Variables}} & \multicolumn{3}{c}{Infant Mortality Rate} \\ \cmidrule(l){2-4} 
\multicolumn{1}{c}{} & \multicolumn{1}{c}{Model 1} & \multicolumn{1}{c}{Model 2} & \multicolumn{1}{c}{Model 3} \\ \midrule
\textit{1. Health Inputs, Access, and Participation} &  &  &  \\
Percent Mothers Receiving Antenatal Care & \begin{tabular}[c]{@{}l@{}}-0.2568*\\ (0.1146)\end{tabular} & \begin{tabular}[c]{@{}l@{}}-0.2474*\\ (0.0896)\end{tabular} & \begin{tabular}[c]{@{}l@{}}-0.2969**\\ (0.0851)\end{tabular} \\
Percent Mothers Receiving JSY & \begin{tabular}[c]{@{}l@{}}0.3005**\\ (0.0860)\end{tabular} & \begin{tabular}[c]{@{}l@{}}0.2952***\\ (0.0735)\end{tabular} & \begin{tabular}[c]{@{}l@{}}0.3004***\\ (0.0751)\end{tabular} \\
Avg. Delivery Expenditure (Rs.) & \begin{tabular}[c]{@{}l@{}}-0.0018*\\ (0.0008)\end{tabular} & \begin{tabular}[c]{@{}l@{}}-0.0018*\\ (0.0008)\end{tabular} & \begin{tabular}[c]{@{}l@{}}-0.0024**\\ (0.0007)\end{tabular} \\
\textit{2. Social Indicators} &  &  &  \\
Percent Adult Females Literate & \begin{tabular}[c]{@{}l@{}}-0.0154\\ (0.2128)\end{tabular} & \multicolumn{1}{c}{—} & \multicolumn{1}{c}{—} \\
Percent Children Underweight & \begin{tabular}[c]{@{}l@{}}0.2440\\ (0.2318)\end{tabular} & \begin{tabular}[c]{@{}l@{}}0.2468\\ (0.1655)\end{tabular} & \multicolumn{1}{c}{—} \\
\textit{3. Modernization Indicators} &  &  &  \\
NSDP Per Capita (Rs.) & \begin{tabular}[c]{@{}l@{}}0.73e-05\\ (0.3e-04)\end{tabular} & \multicolumn{1}{c}{—} & \multicolumn{1}{c}{—} \\
Percent Households using Water Source & \begin{tabular}[c]{@{}l@{}}0.0114\\ (0.1912)\end{tabular} & \multicolumn{1}{c}{—} & \multicolumn{1}{c}{—} \\ \midrule
F-statistic & 10.91*** & 21.60*** & 26.80*** \\
R-squared & 0.7763 & 0.7756 & 0.7557 \\
Intercept Estimate & 28.80 & 29.37 & 39.56 \\
N & 30 & 30 & 30 \\ \midrule
\multicolumn{4}{l}{\begin{tabular}[c]{@{}l@{}}Note: Coefficients are unstandardized and include standard error in parentheses\\ \\ * p \textless 0.05\\ ** p \textless 0.01\\ *** p \textless 0.001\end{tabular}} \\ \bottomrule
\end{tabular}

Nochmals vielen Dank!!

Antwort1

Bildbeschreibung hier eingeben

\documentclass{article}
\usepackage{booktabs}
\usepackage{multirow}
\begin{document}

\begin{table}
\caption{OLS (Ordinary Least Square) Regression Analysis Between Development Indicators And Infant Mortality Rate In India}
\label{key}
\setlength{\tabcolsep}{0pt}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}llll}
\toprule
\multicolumn{1}{c}{\multirow{2}{*}{Independent Variables}} & \multicolumn{3}{c}{Infant Mortality Rate} \\ 
\cmidrule(l){2-4} 
 & \multicolumn{1}{c}{Model 1} & \multicolumn{1}{c}{Model 2} & \multicolumn{1}{c}{Model 3} \\ 
\midrule
\textit{1. Health Inputs, Access, and Participation}                                                \\
Percent Mothers Receiving Antenatal Care & -0.2568* & -0.2474*              & -0.2969**             \\
                                         & (0.1146) &  (0.0896)             & (0.0851)              \\
Percent Mothers Receiving JSY            & 0.3005** & 0.2952***             & 0.3004***             \\
                                         & (0.0860) & (0.0735)              & (0.0751)              \\
Avg. Delivery Expenditure (Rs.)          & -0.0018* & -0.0018*              & -0.0024**             \\
                                         & (0.0008) & (0.0008)              & (0.0007)              \\
\textit{2. Social Indicators}  \\
Percent Adult Females Literate           & -0.0154  & \multicolumn{1}{c}{—} & \multicolumn{1}{c}{—} \\
                                         & (0.2128) &                                               \\
Percent Children Underweight             & 0.2440   & 0.2468                & \multicolumn{1}{c}{—} \\
                                         & (0.2318) & (0.1655)                                      \\
\textit{3. Modernization Indicators} \\
NSDP Per Capita (Rs.)                    & 0.73e-05 & \multicolumn{1}{c}{—} & \multicolumn{1}{c}{—} \\
                                         & (0.3e-04)                                                \\
Percent Households using Water Source    & 0.0114   & \multicolumn{1}{c}{—} & \multicolumn{1}{c}{—} \\ 
                                         & (0.1912) \\ 
\midrule
F-statistic                              & 10.91*** & 21.60***              & 26.80***              \\
R-squared                                & 0.7763   & 0.7756                & 0.7557                \\
Intercept Estimate                       & 28.80    & 29.37                 & 39.56                 \\
N                                        & 30       & 30                    & 30                    \\ 
\midrule
\end{tabular*}
Note: Coefficients are unstandardized and include standard error in parentheses

 * p \textless 0.05 ** p \textless 0.01 *** p \textless 0.001

\end{table}

\end{document}

Antwort2

Ich würde das dcolumnPaket verwenden, um die Zahlen in den drei Datenspalten an ihren Dezimalstellen auszurichten. Außerdem würde ich den \captionBefehl verwenden, um die Überschrift zu setzen, und ich würde eine threeparttableUmgebung verwenden, um die Breite der Überschrift auf die des tabularMaterials einzustellen.

Bildbeschreibung hier eingeben

\documentclass{article}
\usepackage[margin=2.5cm]{geometry} % set page parameters appropriately
\usepackage{booktabs,threeparttable}
\usepackage[font=bf,skip=0.5\baselineskip]{caption}
\usepackage{dcolumn}
\newcolumntype{d}[1]{D..{#1}}
\newcommand\mc[1]{\multicolumn{1}{c}{#1}} % handy shortcut macro
\begin{document}
\addtocounter{table}{2}
\begin{table}[ht!]
\centering
\begin{threeparttable}
\caption{OLS (Ordinary Least Square) Regression Analysis between Development Indicators and Infant Mortality Rate in India}
\begin{tabular}{@{}l*{3}{d{2.6}}@{}}
\toprule
Independent Variables & 
\multicolumn{3}{c@{}}{Infant Mortality Rate} \\ 
\cmidrule(l){2-4} 
 & \mc{Model 1} & \mc{Model 2} & \mc{Model 3} \\ 
\midrule
\em 1. Health Inputs, Access, and Participation  \\
Percent Mothers Receiving Antenatal Care 
  & -0.2568^{*} & -0.2474^{*} & -0.2969^{**}  \\
  & (0.1146) & (0.0896) & (0.0851)  \\
Percent Mothers Receiving JSY 
  & 0.3005^{**} &  0.2952^{***} & 0.3004^{***} \\
  & (0.0860) & (0.0735)   & (0.0751) \\
Avg. Delivery Expenditure (Rs.) 
  & -0.0018^{*} & -0.0018^{*} & -0.0024^{**} \\
  & (0.0008) & (0.0008) & (0.0007) \\
\addlinespace
\em 2. Social Indicators  \\
Percent Adult Females Literate 
  & -0.0154 & \mc{—} & \mc{—} \\
  & (0.2128) \\
Percent Children Underweight 
& 0.2440   & 0.2468 & \mc{—} \\
& (0.2318) & (0.1655) \\
\addlinespace
\em 3. Modernization Indicators \\
NSDP Per Capita (Rs.) 
  & \mc{0.73e-05} & \mc{—} & \mc{—} \\
  & \mc{(0.3e-04)} \\
Percent Households using Water Source 
  & 0.0114 & \mc{—} & \mc{—} \\ 
  & (0.1912) \\
\midrule
$F$-statistic & 10.91^{***} & 21.60^{***} & 26.80^{***} \\
$R^2$ & 0.7763 & 0.7756 & 0.7557 \\
Intercept Estimate & 28.80 & 29.37 & 39.56 \\
$N$ & 30 & 30 & 30 \\ 
\midrule
\multicolumn{4}{@{}l@{}}{Note: Coefficients are unstandardized; standard errors shown in parentheses.}\\
\multicolumn{4}{@{}l@{}}{$^{*}\ p<0.05$; $^{**}\ p<0.01$; $^{***}\ p<0.001$.} \\
\bottomrule
\end{tabular}
\end{threeparttable}
\end{table}
\end{document}

Antwort3

Mit Nutzung aller threetablexFeatures, siunitxPaketierung für SSpalten, korrekter LaTeX-Syntax und konsistenter Verwendung des Et-Zeichens in der Tabelle:

\documentclass{article}

\usepackage{booktabs}
\usepackage[referable]{threeparttablex}
\usepackage[font={small,bf},
            skip=0.33\baselineskip]{caption}
\usepackage{siunitx}
\usepackage{xparse}
\NewExpandableDocumentCommand\mcc{O{1}m}
    {\multicolumn{#1}{c}{#2}}

\addtocounter{table}{2}

\begin{document}
    \begin{table}[ht!]
    \sisetup{input-symbols = {( )},
             table-align-text-pre=false,
             table-space-text-post={$^{***}$},
             table-align-text-post=false,
             table-format=-1.4,
             group-digits = false,
             output-exponent-marker={e},
             tight-spacing=true
                        }
    \setlength\tabcolsep{1.5pt}
\begin{threeparttable}
\caption{OLS (Ordinary Least Square) Regression Analysis between Development Indicators and Infant Mortality Rate in India}
\label{tab:regresion}

\begin{tabular}{@{} l SSS @{}}
    \toprule
Independent Variables & \mcc[3]{Infant Mortality Rate}  \\
    \cmidrule(l){2-4}
    & \mcc{Model 1}     & \mcc{Model 2}     & \mcc{Model 3}     \\
    \midrule
\emph{1. Health Inputs, Access, and Participation}  &&&         \\
Percent Mothers Receiving Antenatal Care
    & -0.2568\tnote{*}  & -0.2474\tnote{*}  & -0.2969\tnote{**} \\
    & (0.1146)          & (0.0896)          & (0.0851)          \\
Percent Mothers Receiving JSY
    & 0.3005\tnote{**}  & 0.2952\tnote{***} & 0.3004\tnote{***} \\
    & (0.0860)          & (0.0735)          & (0.0751)          \\
Avg. Delivery Expenditure (Rs.)
    & -0.0018\tnote{*}  & -0.0018\tnote{*}  & -0.0024\tnote{**} \\
    & (0.0008)          & (0.0008)          & (0.0007)          \\
    \addlinespace
\emph{1. Social Indicators}                         &&&         \\
Percent Adult Females Literate
    & -0.0154           & {--}              & {--}              \\
    & (0.2128)          & {--}              & {--}              \\
Percent Children Underweight
    & 0.2440            & 0.2468            & {--}              \\
    & (0.2318)          & (0.1655)          & {--}              \\
    \addlinespace
\emph{3. Modernization Indicators}                  &&&         \\
NSDP Per Capita (Rs.)
    &  {\num{0.73e-5}}  & {--}              & {--}              \\
    & {(\num{0.30e-4})} & {--}              & {--}              \\
Percent Households using Water Source
    & 0.0114            & {--}              & {--}              \\
    & (0.1912)          & {--}              & {--}              \\
    \midrule
$F$-statistic           
    & 10.91\tnote{***}  & 21.60\tnote{***}  & 26.80\tnote{***}  \\
$R^2$ 
    & 0.7763            & 0.7756            & 0.7557            \\
Intercept Estimate 
    & 28.80             & 29.37             & 39.56             \\
$N$ & 30                & 30                & 30                \\
\bottomrule
\end{tabular}\footnotesize
    \begin{tablenotes}[flushleft, para]
\note{Coefficients are unstandardized; standard errors shown in parentheses.

      \item[*]:     $p<0.05$; 
      \item[**]:    $p<0.01$; 
      \item[***]:   $p<0.001$.}
    \end{tablenotes}
\end{threeparttable}
    \end{table}
\end{document}

Bildbeschreibung hier eingeben

Antwort4

Ich schlage vor, Ihre Tabelle mit siunitxund zu erstellen threeparttable:

\documentclass{article}
\usepackage{multirow}
\usepackage{booktabs, caption}
\usepackage{threeparttable}
\usepackage{siunitx}

\begin{document}

\begin{threeparttable}
\setcounter{table}{2}\captionsetup{font=bf, format=hang, labelsep=period}
\setlength{\tabcolsep}{3pt}
\sisetup{table-format=-1.4, table-space-text-post=***, table-align-text-post=false, input-symbols={()}, group-digits=false}
\caption{OLS (Ordinary Least Square) Regression Analysis Between \\ Development Indicators And Infant Mortality Rate In India}
\centering\small
\begin{tabular}{@{}lSSS@{}}\toprule
\multirow{2}{*}{\centering Independent Variables} & \multicolumn{3}{c}{Infant Mortality Rate} \\ \cmidrule(l){2-4}
& {Model 1} & {Model 2} & {Model 3} \\ \midrule
1. \textit{Health Inputs, Access, and Participation}\\
Percent Mothers Receiving Antenatal Care & 0.2568* & -0.2474 & -0.2969** \\
 & (0.1146) & (0.0896) & (0.0851) \\ \addlinespace
Percent Mothers Receiving JSY & 0.3005** & 0.2952*** & 0.3004***\\
 & (0.0860) & (0.0735) & (0.0751) \\ \addlinespace
Avg. Delivery Expenditure (Rs.) & -0.0018* & -0.0018* & -0.0024** \\
(0.0008) & (0.0008) & (0.0007) \\ \addlinespace
2. \textit{Social Indicators} \\
Percent Adult Females Literate & -0.0154 & {—} & {—} \\
 & (0.2128) \\\addlinespace
Percent Children Underweight & 0.2440 & 0.2468 & {—} \\
 & (0.2318) & (0.1655)\\ \addlinespace
3. \textit{Modernization Indicators} \\
NSDP Per Capita (Rs.) & 0.73{$ \,\mathrm{e}-05 $} & \multicolumn{1}{c}{—} & \multicolumn{1}{c}{—} \\
 & (0.3{$ \,\mathrm{e}-04 $)} \\
Percent Households using Water Source & 0.0114 & {—} & {—} \\
 &(0.1912) \\ \midrule
F-statistic & 10.91*** & 21.60*** & 26.80*** \\
R-squared & 0.7763 & 0.7756 & 0.7557 \\
Intercept Estimate & 28.80 & 29.37 & 39.56 \\
N & 30 & 30 & 30 \\ \bottomrule
\end{tabular}
\begin{tablenotes}[online]
\item[Note:] Coefficients are unstandardized and include standard error in parentheses.

\centering*\enspace$ p < 0.05$,\quad **\enspace$ p < 0.01 $,\quad ***\enspace$ p < 0.001 $.
\end{tablenotes}
\end{threeparttable}

\end{document} 

Bildbeschreibung hier eingeben

verwandte Informationen