0

I am trying to do a similar table in latex but I'm not finding any good source that can help me. How can I write the code so that the mean and variance can look like that. Any help is appreciated

enter image description here

1

Try this code. Hope it helps

\begin{table}[htbp]
  \centering
  \caption{Add caption}
    \begin{tabular}{llll}
    \hline
          &       & Parameter & Standard Error \bigstrut\\
    \hline
    \multirow{7}[2]{*}{Mean} & Const & 0.446 & 0.088 \bigstrut[t]\\
          & ED    & 0.0751 & 0.0063 \\
          & EX    & 0.0278 & 0.0041 \\
          & EX2   & -0.000332 & 0.00087 \\
          & FE    & -0.277 & 0.033 \\
          & NONWH & -0.138 & 0.053 \\
          & UNION & 0.224 & 0.036 \bigstrut[b]\\
    \hline
    \multirow{5}[2]{*}{Variance} & Const & -3.64 & 0.36 \bigstrut[t]\\
          & ED    & 0.0699 & 0.0254 \\
          & EX    & 0.0747 & 0.185 \\
          & EX2   & -0.00121 & 0.0004 \\
          & UNION & 0.0738 & 0.132 \bigstrut[b]\\
    \hline
    \end{tabular}%
  \label{tab:addlabel}%
\end{table}%

Also, add this to your preamble

\usepackage{bigstrut}
1
  • 1
    Yes it worked. Thank you so much! :) Apr 15 at 13:53
0

Since both entries in the first column should be vertically centered with respect to an odd number of rows, there is no need for \multirow. In the following MWE, I modified the previous answer and additionally used horizontal lines from the booktabs package as well as S type columns from the siunitx package in order to align the numbers in the last two columns with respect to the decimal marker:

enter image description here

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

\begin{table}[htbp]
  \centering
  \caption{Add caption}
  \sisetup{group-digits=false}
    \begin{tabular}{llS[table-format=-1.6] S[table-format=1.6]}
    \toprule
             &       & {Parameter} & {Standard Error} \\
    \midrule
             & Const & 0.446       & 0.088   \\
             & ED    & 0.0751      & 0.0063  \\
             & EX    & 0.0278      & 0.0041  \\
     Mean    & EX2   & -0.000332   & 0.00087 \\
             & FE    & -0.277      & 0.033   \\
             & NONWH & -0.138      & 0.053   \\
             & UNION & 0.224       & 0.036   \\
    \midrule
             & Const & -3.64       & 0.36    \\
             & ED    & 0.0699      & 0.0254  \\
    Variance & EX    & 0.0747      & 0.185   \\
             & EX2   & -0.00121    & 0.0004  \\
             & UNION & 0.0738      & 0.132   \\
    \bottomrule
    \end{tabular}%
  \label{tab:addlabel}%
\end{table}%


\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.