0

any suggestion for this desired table

enter image description here

here my code

   \documentclass{article}

   \usepackage{booktabs}
   \usepackage{multirow}
   \usepackage[margin=20mm]{geometry}
   \begin{document}

     \begin{table}
     \begin{tabular}{lSSSSSSSS}
     \toprule
        \multirow{2}{*}{ Markets Models} &
        \multicolumn{2}{c}{HK – MEM(1,1)} &
        \multicolumn{2}{c}{IN- MEM(1,1)} &
        \multicolumn{2}{c}{KO- MEM(1,1)} &
         \multicolumn{2}{c}{MA- MEM(2,1)} \\
       & {Base} & {Selected} & {Base} & {Selected} & {Base} & {Selected}& {Base} & {Selected} 
  \\
    \midrule
        
Loglik & -3267.975 &-3265.314& -3447.357& -3434.800& -3696.633& -3694.599& -3032.638& -3029.500 \\

    LB(12) & 20.920& 13.805& 51.230& 20.545& 23.850& 13.335& 21.729& 15.733 \\
           & 0.052& 0.313& 0.000& 0.057& 0.021& 0.345& 0.041& 0.204 \\

    LBSQ(12)  & 20.212&  13.087&  18.497&  12.647&  15.899&  10.677&  14.488&  10.958\\
              & 0.063& 0.363& 0.101& 0.395& 0.196& 0.557& 0.271& 0.533\\
                        
                        
    $\hat{\Phi}$     &  & 5.61  &  & 3.71   &  & 6.51  &   &4.41 \\
    No spillovers  &  & 2.326 &  & 5.978 &  & 2.372&   & 3.785\\
    p-value         &  & (0.023) &  & (0.000) &  & (0.002)&   &  (0.000)\\
    
    \bottomrule
     \end{tabular}
    \end{table}

    \end{document}

my output :

enter image description here

3
  • Your code is incomplete. It doesn't define the S column type. Mar 7 at 15:48
  • After reading your question again, i wonder, do you really wont a long table? Your document example (it is still uncomplete) you use tabular inside table float. Long table had not to be in float and its syntax is something like this \begin{longtable}{@{}l *{8}{S[table format=...]} @{} } \caption{...} ...etc. Also what is in rows without names? Please advice.
    – Zarko
    Mar 7 at 17:09
  • @zarko I thought I have to use a long table since I'm studying 12 countries means that I have to draw such a table with the same variable and column 3 times. for rows, I thought it will keep values aligned :p . anyway you suggestion is quite helpful. I really appreciate your professional work..
    – Haithem
    Mar 7 at 17:22

1 Answer 1

1
  • your document example is not complete. Mised are:
    • loading package siunitx
    • definition of S column specifications
  • instead of tabular is better to use tabular* table and left to LaTeX that calculate tabcolsep:
\documentclass{article}
\usepackage[margin=20mm, showframe]{geometry}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{siunitx}
\sisetup{
    input-open-uncertainty =,
    input-close-uncertainty=,
    table-align-text-pre=false,
    group-minimum-digits=4,
    group-separator = {,}
        }

\begin{document}

     \begin{table}
     \small
     \setlength\tabcolsep{0pt}
\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}} l
                             *{8}{S[table-format=-4.4]} @{}}
     \toprule
\multirow{2}{*}{Markets Models} 
    &   \multicolumn{2}{c}{HK – MEM(1,1)} 
        &   \multicolumn{2}{c}{IN- MEM(1,1)} 
            &   \multicolumn{2}{c}{KO- MEM(1,1)} 
                &   \multicolumn{2}{c}{MA- MEM(2,1)}        \\
    \cmidrule(lr){2-3}\cmidrule(lr){4-5}
    \cmidrule(lr){6-7}\cmidrule(lr){8-9}
    & {Base}    & {Selected}    & {Base}    & {Selected} 
    & {Base}    & {Selected}    & {Base}    & {Selected}    \\
    \midrule
Loglik 
    & -3267.975 &-3265.314      & -3447.357 & -3434.800
    & -3696.633 & -3694.599     & -3032.638 & -3029.500     \\
LB(12) 
    & 20.920    & 13.805        & 51.230    & 20.545
    & 23.850    & 13.335        & 21.729    & 15.733        \\
    & 0.052     & 0.313         & 0.000     & 0.057
    & 0.021     & 0.345         & 0.041     & 0.204         \\

LBSQ(12)  
    & 20.212    &  13.087       &  18.497   &  12.647
    & 15.899    &  10.677       &  14.488   &  10.958       \\
    & 0.063     & 0.363         & 0.101     & 0.395
    & 0.196     & 0.557         & 0.271     & 0.533         \\
$\hat{\Phi}$     
    &           & 5.61          &           & 3.71   
    &           & 6.51          &           & 4.41          \\
No spillovers  
    &           & 2.326         &           & 5.978 
    &           & 2.372         &           & 3.785         \\
p-value         
    &           & (0.023)       &           & (0.000)
    &           & (0.002)       &           & (0.000)      \\
    \bottomrule
\end{tabular*}
    \end{table}
\end{document}

enter image description here

Addendum:

In the case, that you will need a long table and that numbers in rows without name should be in parenthesis (I suspect this), and a bit better formation than you may consider the following solution (which use the tabularray package):

\documentclass{article}
\usepackage[margin=20mm]{geometry}
%---------------- Show page layout. Don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage{lipsum}% For dummy text. Don't use in a real document

\usepackage{xcolor}
\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx}
\sisetup{
    input-open-uncertainty =,
    input-close-uncertainty=,
    table-align-text-pre=false,
    group-minimum-digits=4,
    group-separator = {,}
        }
\SetTblrStyle{caption-tag}{font=\small\scshape}
\SetTblrStyle{caption-text}{font=\small\scshape}

\begin{document}
\lipsum[1-7]
\begin{longtblr}[
caption = {Model Diagnostic},
  label = {tab:MD}
                ]{rowhead = 2,
                  colsep  = {3pt},
                  colspec = {@{}l *{8}{X[c, si={table-format=-4.3{)}}]} @{}},
                  row{3-X}= {rowsep = 0pt},
                    rows  = {font=\small}
                 }
     \toprule
\SetCell[r=2]{c}    Markets Models 
    &   \SetCell[c=2]{c}    {{{HK – MEM(1,1)}}} 
        &   &   \SetCell[c=2]{c}    {{{IN -- MEM(1,1)}}} 
            &   &   \SetCell[c=2]{c}    {{{KO -- MEM(1,1)}}} 
                &   &   \SetCell[c=2]{c}    {{{MA -- MEM(2,1)}}}  \\
    \cmidrule[lr]{2-3}\cmidrule[lr]{4-5}
    \cmidrule[lr]{6-7}\cmidrule[lr]{8-9}
    & {{{Base}}}    & {{{Selected}}}    & {{{Base}}}    & {{{Selected}}} 
    & {{{Base}}}    & {{{Selected}}}    & {{{Base}}}    & {{{Selected}}}    \\
    \midrule
Loglik 
    & -3267.975     &-3265.314      & -3447.357 & -3434.800
    & -3696.633     & -3694.599     & -3032.638 & -3029.500     \\
    \addlinespace
LB(12) 
    & 20.920        & 13.805        & 51.230    & 20.545
    & 23.850        & 13.335        & 21.729    & 15.733        \\
    & (0.052)       & (0.313)       & (0.000)   & (0.057) 
    & (0.021)       & (0.345)       & (0.041)   & (0.204)       \\
    \addlinespace
LBSQ(12)  
    & 20.212        &  13.087       &  18.497   &  12.647
    & 15.899        &  10.677       &  14.488   &  10.958       \\
    & (0.063)       & (0.363)       & (0.101)   & (0.395)
    & (0.196)       & (0.557)       & (0.271)   & (0.533)       \\
    \addlinespace
$\hat{\Phi}$     
    &               & 5.61          &           & 3.71   
    &               & 6.51          &           & 4.41          \\
    \midrule[0.15pt, fg=gray]
No spillovers
    &               & 2.326         &           & 5.978
    &               & 2.372         &           & 3.785         \\
p-value
    &               & (0.023)       &           & (0.000)
    &               & (0.002)       &           & (0.000)      \\
    \midrule[2pt, fg=gray]
\SetCell[c=9]{c}    some text (as title for next table part)
    &   &   &   &   &   &   &   &                           \\
    \midrule
Loglik
    & -3267.975     &-3265.314      & -3447.357 & -3434.800
    & -3696.633     & -3694.599     & -3032.638 & -3029.500     \\
    \addlinespace
LB(12)
    & 20.920        & 13.805        & 51.230    & 20.545
    & 23.850        & 13.335        & 21.729    & 15.733        \\
    & (0.052)       & (0.313)       & (0.000)   & (0.057)
    & (0.021)       & (0.345)       & (0.041)   & (0.204)       \\
    \addlinespace
LBSQ(12)
    & 20.212        &  13.087       &  18.497   &  12.647
    & 15.899        &  10.677       &  14.488   &  10.958       \\
    & (0.063)       & (0.363)       & (0.101)   & (0.395)
    & (0.196)       & (0.557)       & (0.271)   & (0.533)       \\
    \addlinespace
$\hat{\Phi}$
    &               & 5.61          &           & 3.71
    &               & 6.51          &           & 4.41          \\
    \midrule[0.15pt, fg=gray]
No spillovers
    &               & 2.326         &           & 5.978
    &               & 2.372         &           & 3.785         \\
p-value
    &               & (0.023)       &           & (0.000)
    &               & (0.002)       &           & (0.000)      \\
    \bottomrule
\end{longtblr}
\end{document}

enter image description here

2
  • @Haithem, see addendum to answer. It may be helpful. Does answer deserve to be up-voted too ;-)
    – Zarko
    Mar 7 at 17:51
  • I am so very thankful for your time. Thank you for sharing your expertise.
    – Haithem
    Mar 7 at 19:15

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.