1

How can I have a table like the following picture in latex?

enter image description here

here the code i used

\documentclass[final,1p,times,authoryear]{elsarticle}

\usepackage{graphicx}
\usepackage{adjustbox}
\usepackage{tabularx} 
\usepackage{amsmath}%
\begin{document}
\begin{table}[h]
  \caption{Augmented DickeyFuller and KPSS Test Statistics for (Transformed) Sectoral Indices(y)}
    \label{tab:Augmented DickeyFuller and KPSS Test Statistics for (Transformed) Sectoral Indices(y)}
    \renewcommand{\arraystretch}{1.2}
         \renewcommand*\TPTnoteLabel[1]{\parbox[b]{3em}{\hfill#1\,}}
          \begin{adjustbox}{max width=\textwidth}
    \centering 
        \begin{tabular}{l c c c c c c}
        \hline
        &&&\multicolumn{3}{c}{}\\ \cline{2-3}
         \textit{ }  \textbf{variables}& \textbf{Levin, Lin and Chu (LLC)}& \textbf{ADF-Fisher chi-square }\\
        \hline
         \cline{1-2}
        \textbf{Banking-industry specific variables}& &&&&& \\
                &&\\
        \hline
        Log of Loans-to-Assets&-2.14&151.23&&&& \\
                &\textit{(0.05)}&\textit{(0.02)}\\
        \hline
         Log of Credit quality&-0.486&144.13&&&& \\
                &\textit{(0.04)}&\textit{(0.01)}\\
        \hline
       Log of Diversification& 2.441&112.23&&&& \\
                &\textit{(0.02)}&\textit{(0.04)}\\
        \hline
        Log of Return on Assets&-3.235&1.140\\
                &\textit{(0.01)}&\textit{(0.03)}\\
        \hline
        \textbf{Macroeconomic variables}&Fisher-ADF&&&&&\\
          &&\\
        \hline
       Real GDP growth&-1.66&&&&&\\
                 &\textit{(0.048)}&\\
                \hline
                \Delta infl (inflation)&-4.62&&&&&\\
                 &\textit{(0.145)}&\\
        \hline
                \Delta Ur (unemployment rate)&-1.45&&&&&\\
                 &\textit{(0.014)}&\\
                \hline
                Exchange rate &-0.76&&&&&\\
                 &\textit{(0.042)}&\\
                 \hline
        \textbf{Household-level indicators}&Fisher-ADF&&&&&\\
                &&\\
                \hline
       Income&1.30&&&&&\\
                 &\textit{(0.001)}&\\
                \hline
                Family size&-1.07&&&&&\\
                 &\textit{(0.007)}&\\
        \hline
                Age&-3.02&&&&&\\
                 &\textit{(0.002)}&\\
                \hline
                Education &-1.91&&&&&\\
                 &\textit{(0.000))}&\\
                 \hline
    \end{tabular}
        \end{adjustbox}
\end{table}
\end{document}
2
  • Yes you can. And, I'd say, nicer than that. Could post what you've tried?
    – Bernard
    Sep 7, 2018 at 12:22
  • HERE the code i used
    – HAITHEM
    Sep 7, 2018 at 13:06

1 Answer 1

1

i would redesign your table in the following form:

enter image description here

(red lines indicate text border)

to your document i add packages booktabs, makecell, tabularx and siunitx.

\documentclass[final,1p,times,authoryear]{elsarticle}
\usepackage{booktabs, makecell, tabularx}
\renewcommand\theadfont{\bfseries}
\renewcommand\theadgape{}
\usepackage{siunitx}%

%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\begin{document}
    \begin{table}[h]
    \centering
\caption{Augmented Dickey Fuller and KPSS Test Statistics for (Transformed) Sectoral Indices (y)}
\label{tab:statistics}
\renewcommand{\arraystretch}{1.2}
\sisetup{input-symbols={( - )},
         table-space-text-pre={(},
         table-space-text-post ={)},
         }
    \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}
                            l
                       *{2}{S[table-format=-1.3]
                            @{\hspace{-1em}}
                             S[table-format=1.2]}
                                }
    \toprule
\thead[l]{variables\\Banking-industry specific variables}
    &   \multicolumn{2}{c}{\thead{Levin, Lin and\\ Chu (LLC)}}
        &   \multicolumn{2}{c}{\thead{ADF-Fisher\\ chi-square}}    \\
     \cmidrule(r){1-1}\cmidrule(r){2-3}\cmidrule{4-5}
Log of Loans-to-Assets  &-2.14  & (0.05)    & 151.23    & (0.02)    \\
Log of Credit quality   &-0.486 & (0.04)    & 144.13    & (0.01)    \\
Log of Diversification  & 2.441 & (0.02)    & 112.23    & (0.04)    \\
Log of Return on Assets &-3.235 & (0.01)    & 1.140     & (0.03)    \\
    \midrule
\textbf{Macroeconomic variables}
                        &       &           &
                                    \multicolumn{2}{c}{Fisher-ADF}  \\
    \midrule
Real GDP growth         &       &           & -1.66     & (0.048)   \\
$\Delta$ infl (inflation)
                        &       &           & -4.62     & (0.145)   \\
$\Delta$ Ur (unemployment rate)
                        &       &           & -1.45     & (0.014)   \\
Exchange rate           &       &           & -0.76     & (0.042)   \\
    \midrule
\textbf{Household-level indicators}
                        &       &           &
                                    \multicolumn{2}{c}{Fisher-ADF}  \\
    \midrule
Income                  &       &           & 1.30      & (0.001)   \\
Family size             &       &           & -1.07     & (0.007)   \\
Age                     &       &           & -3.02     & (0.002)   \\
Education               &       &           & -1.91     & (0.000)   \\
    \bottomrule
\end{tabular*}
    \end{table}
\end{document}

about table design is worth to see Wie Tabellen eigentlich aussehen sollten :-).

2
  • thanks for the help actually i want the p value which are in bracket under each number as in the picture.
    – HAITHEM
    Sep 7, 2018 at 15:22
  • @Haithem, i only show, how i would design your table. of course you can persist with your design. from my code should not be difficult to rewrote it to what you like to have.
    – Zarko
    Sep 7, 2018 at 16:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .