[Tex/LaTex] Help with regression table

tables

I need some help with building regression tables in Latex.

What I wanted to do is to create three new columns in the right, just like the three ones that are already there with the content for a "scenario 2", just like the "scenario 1" as you will be able to see in the table, with the same dependent variables, same specifications and same covariates.

I send the code for the table I've been working on below:

\documentclass{article}

\usepackage{float}              
\floatstyle{plaintop}           
\restylefloat{table}

\usepackage{booktabs}
\usepackage{dcolumn}
\newcolumntype{d}[1]{D..{#1}}
\newcommand{\mc}[1]{\multicolumn{1}{c@{}}{#1}}

\begin{document}

\begin{table}[H]
\centering 
  \caption{} 
  \label{}

\smallskip
\begin{tabular}{@{} l *{3}{d{2.6}} @{}} 
\toprule
& \multicolumn{3}{c@{}}{Scenario 1} \\ 
\cmidrule(l){2-4} 
& \multicolumn{3}{c@{}}{\textit{test}} \\[1ex] 
& \mc{only treat} & \mc{treat + coduf} & \mc{all covs} \\ 
\midrule
 $treat$ & 0.023 & 0.027 & 0.046 \\ 
  & (0.023) & (0.027) & (0.046) \\ [1ex]
 $coduf$ & & 0.002 & 0.003 \\ 
  & & (0.003) & (0.003) \\ [1ex]
 $mat\_casa$ &  &  & 0.043^{**} \\ 
  &  &  & (0.019) \\  [1ex]
 $abast\_agua2$ &  &  & -0.004 \\ 
  &  &  & (0.008) \\ [1ex]
 $trat\_agua$ &  &  & -0.004 \\ 
  &  &  & (0.012) \\ [1ex]
 $esgoto$ &  &  & 0.015 \\ 
  &  &  & (0.018) \\ [1ex]
 $sexo$ &  &  & 0.193^{***} \\ 
  &  &  & (0.042) \\ [1ex]
 $idade$ &  &  & 0.006^{***} \\ 
  &  &  & (0.001) \\ [1ex]
 $cor\_raca$ &  &  & 0.037^{**} \\ 
  &  &  & (0.015) \\ [1ex]
 $escol$ &  &  & -0.009 \\ 
  &  &  & (0.009) \\ [1ex]
 $comodos$ &  &  & -0.008 \\ 
  &  &  & (0.102) \\ [1ex]
 \textit{constant} & 0.230^{***} & 0.174^{**} & -0.506^{***} \\ 
  & (0.034) & (0.092) & (0.172) \\ [1ex]
\midrule
   F-test & \multicolumn{1}{c}{0.2661} & \multicolumn{1}{c}{0.2122} & \multicolumn{1}{c}{$7.6729^{***}$} \\
   AIC & \multicolumn{1}{c}{37{,}997.73} & \multicolumn{1}{c}{38{,}099.51} & \multicolumn{1}{c}{33{,}477.07} \\
   N & \multicolumn{1}{c}{624} & \multicolumn{1}{c}{624} & \multicolumn{1}{c}{624} \\
\bottomrule
\multicolumn{3}{@{}l@{}}{\footnotesize Nota: $^{*}\, p<0.1$; $^{**}\, p<0.05$; $^{***}\, p<0.01$}
\end{tabular} 
\end{table}

\end{document}

Best Answer

Most likely I do not understand the question, but what prevents you from just adding the columns? Of course, I do not have the data that is to be filled in, so I left it blank. Let me also remark that I would not use $ to make text italic, use \textit{...} instead.

\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{float}              
\floatstyle{plaintop}           
\restylefloat{table}

\usepackage{booktabs}
\usepackage{dcolumn}
\newcolumntype{d}[1]{D..{#1}}
\newcommand{\mc}[1]{\multicolumn{1}{c@{}}{#1}}

\begin{document}

\begin{table}[H]
\centering 
  \caption{} 
  \label{}

\smallskip
\begin{tabular}{@{} l *{6}{d{5.6}} @{}} 
\toprule
& \multicolumn{3}{c@{}}{Scenario 1} & \multicolumn{3}{c@{}}{Scenario 2} \\ 
\cmidrule(l){2-7} 
& \multicolumn{3}{c@{}}{\textit{test}} \\[1ex] 
& \mc{only treat} & \mc{treat + coduf} & \mc{all covs} 
& \mc{only treat} & \mc{treat + coduf} & \mc{all covs}\\ 
\midrule
 $treat$ & 0.023 & 0.027 & 0.046 \\ 
  & (0.023) & (0.027) & (0.046) \\ [1ex]
 $coduf$ & & 0.002 & 0.003 \\ 
  & & (0.003) & (0.003) \\ [1ex]
 $mat\_casa$ &  &  & 0.043^{**} \\ 
  &  &  & (0.019) \\  [1ex]
 $abast\_agua2$ &  &  & -0.004 \\ 
  &  &  & (0.008) \\ [1ex]
 $trat\_agua$ &  &  & -0.004 \\ 
  &  &  & (0.012) \\ [1ex]
 $esgoto$ &  &  & 0.015 \\ 
  &  &  & (0.018) \\ [1ex]
 $sexo$ &  &  & 0.193^{***} \\ 
  &  &  & (0.042) \\ [1ex]
 $idade$ &  &  & 0.006^{***} \\ 
  &  &  & (0.001) \\ [1ex]
 $cor\_raca$ &  &  & 0.037^{**} \\ 
  &  &  & (0.015) \\ [1ex]
 $escol$ &  &  & -0.009 \\ 
  &  &  & (0.009) \\ [1ex]
 $comodos$ &  &  & -0.008 \\ 
  &  &  & (0.102) \\ [1ex]
 \textit{constant} & 0.230^{***} & 0.174^{**} & -0.506^{***} \\ 
  & (0.034) & (0.092) & (0.172) \\ [1ex]
\midrule
   F-test & \multicolumn{1}{c}{0.2661} & \multicolumn{1}{c}{0.2122} & \multicolumn{1}{c}{$7.6729^{***}$} \\
   AIC & \multicolumn{1}{c}{37{,}997.73} & \multicolumn{1}{c}{38{,}099.51} & \multicolumn{1}{c}{33{,}477.07} \\
   N & \multicolumn{1}{c}{624} & \multicolumn{1}{c}{624} & \multicolumn{1}{c}{624} \\
\bottomrule
\multicolumn{3}{@{}l@{}}{\footnotesize Nota: $^{*}\, p<0.1$; $^{**}\, p<0.05$; $^{***}\, p<0.01$}
\end{tabular} 
\end{table}
\end{document}

enter image description here

Related Question