使用 dcolumn 格式化变量名称中带有“.”的回归表

使用 dcolumn 格式化变量名称中带有“.”的回归表

我长期以来一直习惯esttab将回归表从 stata 输出到 LaTeX。现在我试图按小数位排列列。我遇到的问题是左侧的系数标签中有“。”(它们是变量名)。因此,它们也按“。”排列,我不喜欢这样。我可以进入并在变量名周围加上“$”,但这需要大量的手动工作,我试图在 esttab 输出后尽量减少这部分工作。有没有办法使用 dcolumn,使得带有“。”的变量名不受 dcolumn 规则的约束?

%% PAPER FORMATTING STUFF%{{*{
% DOCUMENT SETTINGS%{{*{
\documentclass[12pt,letter]{article}\usepackage{titling}
\newcommand{\subtitle}[1]{%
  \posttitle{%
    \par\end{center}
    \begin{center}\large#1\end{center}
    \vskip0.5em}%
}

% In your .tex file
% !TEX program = pdflatex 


%% % School color found from university's graphic identity site:
%% % http://isites.harvard.edu/icb/icb.do?keyword=k75408&pageid=icb.page392732
%% \definecolor{SchoolColor}{rgb}{0.6471, 0.1098, 0.1882} % Crimson
%% \definecolor{chaptergrey}{rgb}{0.6471, 0.1098, 0.1882} % for chapter numbers


% keep exhibits in their section%{{*{
\usepackage[section]{placeins}
% fix the floats for the tables
\usepackage{float}
\usepackage{subcaption} 
% keep exhibits in their section%}*}}

%\renewcommand*{\familydefault}{\ttdefault}


%\parindent0pt  % to stop indenting paragraphs
%\usepackage{helvet}
%\usepackage{hyperref}



%\hypersetup{
%    colorlinks,
%    citecolor=blue,
%    filecolor=black,
%    linkcolor=black,
%    urlcolor=blue,
%}

\usepackage{fullpage}
\usepackage{tabularx}
 \usepackage{graphicx}
\usepackage{dcolumn}
 \usepackage{lscape} 
    % for landscape orientation of reg tables.  must be after the graphx?
%\usepackage[top=1cm, bottom=2cm, left=2cm, right=2cm]{geometry}
\usepackage{geometry}
%}*}}



\begin{document}

%\newcolumntype{.}{D{.}{.}{5.5}}
\newcolumntype{d}[1]{D{.}{.}{#1}}
\begin{table}[htbp]\centering
        \footnotesize
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\caption{Estimation of Differential Effects: Measurement of Scandal Using Media Attention \label{tab:misconduct_t4.tex}} 
                \begin{tabular}{d{-1}d{-1}d{-1}d{-1}d{-1}{c}}
                      % exlstop still working on figuring out dcolumn
\hline\hline
                &\multicolumn{1}{c}{(1)}&\multicolumn{1}{c}{(2)}&\multicolumn{1}{c}{(3)}&\multicolumn{1}{c}{(4)}&\multicolumn{1}{c}{(5)}\\
                &\multicolumn{1}{c}{Scandal}&\multicolumn{1}{c}{Departure Timing}&\multicolumn{1}{c}{Recency}&\multicolumn{1}{c}{Function}&\multicolumn{1}{c}{Seniority}\\
\hline
scandal.continuous&   -0.090\sym{***}&   -0.101\sym{**} &   -0.077         &   -0.082\sym{**} &   -0.131\sym{***}\\
                &  (0.021)         &  (0.032)         &  (0.044)         &  (0.023)         &  (0.034)         \\
departed.recent x scandal.continuous&                  &    0.026         &                  &                  &                  \\
                &                  &  (0.037)         &                  &                  &                  \\
scandal.recent x scandal.continuous&                  &                  &   -0.026         &                  &                  \\
                &                  &                  &  (0.060)         &                  &                  \\
finance         &                  &                  &                  &    0.000         &                  \\
                &                  &                  &                  &  (0.016)         &                  \\
finance x scandal.continuous&                  &                  &                  &   -0.153\sym{***}&                  \\
                &                  &                  &                  &  (0.028)         &                  \\
junior.placement&                  &                  &                  &                  &   -0.121\sym{***}\\
                &                  &                  &                  &      \            &  (0.028)         \\
junior.placement x scandal.continuous&                  &                  &                  &                  &    0.117\sym{**} \\
                &                  &                  &                  &                  &  (0.035)         \\
log(total.prior.comp)&    0.366\sym{***}&    0.366\sym{***}&    0.366\sym{***}&    0.385\sym{***}&    0.365\sym{***}\\
                &  (0.036)         &  (0.029)         &  (0.029)         &  (0.037)         &  (0.031)         \\
perform.comp    &    1.230\sym{***}&    1.230\sym{***}&    1.230\sym{***}&    1.246\sym{***}&    1.232\sym{***}\\
                &  (0.112)         &  (0.119)         &  (0.119)         &  (0.113)         &  (0.115)         \\
job.rank        &   -0.115\sym{***}&   -0.115\sym{***}&   -0.115\sym{***}&   -0.116\sym{***}&                  \\
                &  (0.014)         &  (0.021)         &  (0.021)         &  (0.012)         &                  \\
total.experience&    0.005\sym{**} &    0.005\sym{***}&    0.005\sym{***}&    0.005\sym{**} &    0.005\sym{***}\\
                &  (0.001)         &  (0.001)         &  (0.001)         &  (0.001)         &  (0.001)         \\
gender          &   -0.020         &   -0.020         &   -0.020         &   -0.032         &   -0.020         \\
                &  (0.021)         &  (0.018)         &  (0.018)         &  (0.019)         &  (0.018)         \\
mba             &    0.026         &    0.026         &    0.025         &    0.025         &    0.026         \\
                &  (0.023)         &  (0.028)         &  (0.028)         &  (0.025)         &  (0.026)         \\
ivy.league      &    0.071\sym{***}&    0.070\sym{**} &    0.071\sym{**} &    0.078\sym{***}&    0.077\sym{**} \\
                &  (0.011)         &  (0.021)         &  (0.021)         &  (0.013)         &  (0.022)         \\
highest.deg     &   -0.003         &   -0.003         &   -0.003         &   -0.000         &   -0.002         \\
                &  (0.015)         &  (0.020)         &  (0.020)         &  (0.016)         &  (0.019)         \\
size1           &   -0.025         &   -0.025         &   -0.025         &   -0.040         &   -0.024         \\
                &  (0.056)         &  (0.066)         &  (0.066)         &  (0.049)         &  (0.069)         \\
size2           &   -0.015         &   -0.014         &   -0.015         &   -0.042         &   -0.010         \\
                &  (0.067)         &  (0.064)         &  (0.064)         &  (0.057)         &  (0.065)         \\
size3           &    0.077         &    0.077         &    0.077         &    0.053         &    0.079         \\
                &  (0.056)         &  (0.049)         &  (0.048)         &  (0.047)         &  (0.051)         \\
size4           &    0.037         &    0.037         &    0.037         &    0.012         &    0.038         \\
                &  (0.065)         &  (0.050)         &  (0.050)         &  (0.055)         &  (0.052)         \\
size5           &    0.062         &    0.062         &    0.062         &    0.029         &    0.063         \\
                &  (0.073)         &  (0.058)         &  (0.057)         &  (0.062)         &  (0.060)         \\
public          &    0.041         &    0.041\sym{*}  &    0.040\sym{*}  &    0.034         &    0.039         \\
                &  (0.020)         &  (0.019)         &  (0.019)         &  (0.020)         &  (0.019)         \\
Constant        &    8.006\sym{***}&    8.006\sym{***}&    8.006\sym{***}&    7.828\sym{***}&    7.966\sym{***}\\
                &  (0.569)         &  (0.407)         &  (0.406)         &  (0.552)         &  (0.428)         \\
job.funct       & in model         & in model         & in model         &not in model         & in model         \\
industry        & in model         & in model         & in model         & in model         & in model         \\
region          & in model         & in model         & in model         & in model         & in model         \\
year            & in model         & in model         & in model         & in model         & in model         \\
\hline
Observations    &     1970         &     1970         &     1970         &     1970         &     1970         \\
\(R^{2}\)       &     0.66         &     0.66         &     0.66         &     0.65         &     0.66         \\
Adjusted \(R^{2}\)&    0.647         &    0.647         &    0.647         &    0.636         &    0.646         \\
\hline\hline
\multicolumn{6}{l}{\footnotesize Standard errors in parentheses}\\
\multicolumn{6}{l}{\footnotesize \sym{*} \(p<0.05\), \sym{**} \(p<0.01\), \sym{***} \(p<0.001\)}\\
\end{tabular}
\end{table}


\end{document}

这里

答案1

查看前两个回复(谢谢!),第一个 d{-1} 表示第一列数字,而不是变量名称。因此,将第一个更改为“l”不起作用。但我确实尝试在第一个 d{-1} 之前添加(前置)“l”列,这似乎有效。

相关内容