Outreg2 回归表的小数对齐问题

Outreg2 回归表的小数对齐问题

伙计们,有人能找出这里出了什么问题吗?我从 outreg2 stata 中获取了此表,并根据 clemen 的回答进行了一些编辑这个帖子。 谢谢!

\documentclass[]{article}


\usepackage{amsfonts}
\usepackage{amsmath,array}
\usepackage[detect-all]{siunitx}
\usepackage[margin=1 in]{geometry}
\usepackage{booktabs, longtable}
\usepackage[english]{babel}

\setlength{\pdfpagewidth}{8.5in} \setlength{\pdfpageheight}{11in}
\begin{document}
\sisetup{
  input-symbols         = (),
  table-format          = -1.4,
  table-space-text-post = ***,
  table-align-text-post = false,
  group-digits          = false
}
\begin{tabular}{l *{8}{S}} \hline
 & (1) & (2) & (3) & (4) & (5) & (6) & (7) & (8) \\
Variables & FullD & FullD & FullD & FullD & FullD & FullD & FullD & FullD \\ \hline
 &  &  &  &  &  &  &  &  \\
STI\_30 & 0.301*** & 0.179** & 0.152* & 0.159 & -0.000 & 0.107 & 0.097 & 0.115 \\
 & (0.087) & (0.085) & (0.085) & (0.097) & (0.003) & (0.084) & (0.094) & (0.105) \\
Produce\_Full\_SR &  & 0.349*** & 0.321*** & 0.303* & 0.318*** & 0.270*** & 0.244*** & 0.257*** \\
 &  & (0.071) & (0.074) & (0.170) & (0.074) & (0.074) & (0.078) & (0.090) \\
Has\_Sus\_Efforts &  &  & 0.078*** & 0.077*** & 0.245*** & 0.001 & 0.046** & 0.129*** \\
 &  &  & (0.020) & (0.020) & (0.094) & (0.013) & (0.019) & (0.041) \\
1o.STI\_30\#1o.Produce\_Full\_SR &  &  &  & 0.000 &  &  &  &  \\
 &  &  &  & (0.000) &  &  &  &  \\
1o.STI\_30\#1o.Has\_Sus\_Efforts &  &  &  &  & 0.000 &  &  &  \\
 &  &  &  &  & (0.000) &  &  &  \\
Water\_Efforts &  &  &  &  &  & 0.168*** &  &  \\
 &  &  &  &  &  & (0.039) &  &  \\
C\_or\_S &  &  &  &  &  &  & 0.202*** &  \\
 &  &  &  &  &  &  & (0.066) &  \\
C\_or\_S1 &  &  &  &  &  &  &  & 0.221** \\
 &  &  &  &  &  &  &  & (0.100) \\
Constant & 0.054*** & 0.029*** & -0.001 & -0.002 & 0.000 & -0.001 & 0.000 & 0.000 \\
 & (0.010) & (0.008) & (0.003) & (0.003) & (0.003) & (0.003) & (0.000) & (0.000) \\
 &  &  &  &  &  &  &  &  \\
Observations & 566 & 555 & 552 & 552 & 552 & 552 & 252 & 140 \\
Year FE & No & No & No & No & No & No & No & No \\
Nb of obs & 566 & 555 & 552 & 552 & 552 & 552 & 252 & 140 \\
 Adjusted R-squared & 0.0696 & 0.211 & 0.233 & 0.232 & 0.234 & 0.275 & 0.199 & 0.133 \\ \hline
\multicolumn{9}{c}{ Robust standard errors in parentheses} \\
\multicolumn{9}{c}{ *** p$<$0.01, ** p$<$0.05, * p$<$0.1} \\
\end{tabular}
\end{document}

约翰尼

答案1

类型列中S不符合预期数字格式的单元格(包括诸如(1)FullDNo552和 等单元格0.0696)必须居中。

最简单的方法是将单元格内容括在花括号中。例如,

Variables & FullD & FullD & FullD & FullD & FullD & FullD & FullD & FullD

您需要输入

Variables & {FullD} & {FullD} & {FullD} & {FullD} & {FullD} & {FullD} & {FullD} & {FullD}

由于表格非常宽,因此需要以横向格式呈现。一种方法是加载包rotating并利用其sidewaystable环境。

最后,由于您正在加载booktabs包,请使用它的、、\toprule和指令而不是。\midrule\bottomrule\addlinespace\hline

在此处输入图片描述

\documentclass{article}
\usepackage[letterpaper,margin=1in]{geometry}
\setlength{\pdfpagewidth}{8.5in} 
\setlength{\pdfpageheight}{11in}
\usepackage[english]{babel}

\usepackage{amssymb,amsmath,array}
\usepackage{siunitx} % don't use 'detect-all' switch unless you know what you're doing
\usepackage{booktabs}
\usepackage{rotating} % for 'sidewaystable' env.

\begin{document}
\begin{sidewaystable}
\sisetup{
  input-symbols         = (),
  table-format          = -1.3,
  table-space-text-post = ***,
  table-align-text-post = false,
  group-digits          = false
}
\noindent
\begin{tabular}{@{}l *{8}{S} @{}} 
\toprule
          & {(1)} & {(2)} & {(3)} & {(4)} & {(5)} & {(6)} & {(7)} & {(8)} \\
Variables & {FullD} & {FullD} & {FullD} & {FullD} & {FullD} & {FullD} & {FullD} & {FullD} \\ 
\midrule
STI\_30   & 0.301*** & 0.179** & 0.152* & 0.159 & -0.000 & 0.107 & 0.097 & 0.115 \\
          & (0.087) & (0.085) & (0.085) & (0.097) & (0.003) & (0.084) & (0.094) & (0.105) \\
Produce\_Full\_SR &  & 0.349*** & 0.321*** & 0.303* & 0.318*** & 0.270*** & 0.244*** & 0.257*** \\
          &  & (0.071) & (0.074) & (0.170) & (0.074) & (0.074) & (0.078) & (0.090) \\
Has\_Sus\_Efforts &  &  & 0.078*** & 0.077*** & 0.245*** & 0.001 & 0.046** & 0.129*** \\
          &  &  & (0.020) & (0.020) & (0.094) & (0.013) & (0.019) & (0.041) \\
1o.STI\_30\#1o.Produce\_Full\_SR &  &  &  & 0.000 &  &  &  &  \\
          &  &  &  & (0.000) &  &  &  &  \\
1o.STI\_30\#1o.Has\_Sus\_Efforts &  &  &  &  & 0.000 &  &  &  \\
          &  &  &  &  & (0.000) &  &  &  \\
Water\_Efforts &  &  &  &  &  & 0.168*** &  &  \\
          &  &  &  &  &  & (0.039) &  &  \\
C\_or\_S  &  &  &  &  &  &  & 0.202*** &  \\
          &  &  &  &  &  &  & (0.066) &  \\
C\_or\_S1 &  &  &  &  &  &  &  & 0.221** \\
          &  &  &  &  &  &  &  & (0.100) \\
Constant  & 0.054*** & 0.029*** & -0.001 & -0.002 & 0.000 & -0.001 & 0.000 & 0.000 \\
          & (0.010) & (0.008) & (0.003) & (0.003) & (0.003) & (0.003) & (0.000) & (0.000) \\
\midrule
Observations & {566} & {555} & {552} & {552} & {552} & {552} & {252} & {140} \\
Year FE      & {No} & {No} & {No} & {No} & {No} & {No} & {No} & {No} \\
Nr.\ of obs  & {566} & {555} & {552} & {552} & {552} & {552} & {252} & {140} \\
Adj.\ R\textsuperscript{2} & {0.0696} & {0.211} & {0.233} & {0.232} & {0.234} & {0.275} & {0.199} & {0.133} \\ 
\bottomrule
\addlinespace
\multicolumn{9}{c}{Robust standard errors in parentheses} \\
\multicolumn{9}{c}{$^{***}\ p<0.01$; $^{**}\ p<0.05$, $^{*}\ p<0.1$} \\
\end{tabular}
\end{sidewaystable}
\end{document}

相关内容