0

here is my table but I can't figure out how to arrange 4 more column on the right side.

 \begin{sidewaystable}
 \centering
\caption{Realtime forecast RMSEs}
 \label{forecast}
 \begin{tabular}{@{}l
    c
    *{6}{S[table-format=1.6, group-digits=false]}
    S[table-format=-1.6, group-digits=false]
    S[table-format=1.6, group-digits=false]@{}}

\toprule
\multirow{2}[3]{*}{\bfseries Parameters} & \multicolumn{2}{c}{\makecell{\bfseries $S\&P$ \\ $\boldsymbol{h=2Q}$}} & 
  \multicolumn{2}{c}{\makecell{\bfseries GDP \\ $\boldsymbol{h=2Q}$}} &
  \multicolumn{2}{c}{\makecell{\bfseries Unemployment \\ \bfseries $\boldsymbol{h=2Q}$}} &
    \multicolumn{2}{c}{\makecell{\bfseries house price index \\ \bfseries $\boldsymbol{h=2Q}$}} &
  \multicolumn{2}{c}{\makecell{\bfseries Inflation \\ \bfseries $\boldsymbol{h=2Q}$}} \\
\cmidrule(lr){2-3} \cmidrule(lr){4-5} \cmidrule(lr){6-7} \cmidrule(lr){8-9}
& \multicolumn{1}{c}{\bfseries Mean} & \multicolumn{1}{c}{\bfseries RMSE} & \multicolumn{1}{c}{\bfseries Mean} & \multicolumn{1}{c}{\bfseries RMSE} & \multicolumn{1}{c}{\bfseries Mean} & \multicolumn{1}{c}{\bfseries RMSE} & \multicolumn{1}{c}{\bfseries Mean} & \multicolumn{1}{c}{\bfseries RMSE} \\
\midrule
$b_k = 0$ &     &       &        &       &      &       &       &        \\
\hspace{7pt} $\beta$ & 0.097  & 0.009& 0.245 & 0.009 & 0.013 & 0.089 & 0.003& 0.078 \\
\hspace{7pt} $\sigma$ & 0.003  & 0.013 & 0.077& 0.015 & 0.065 & 0.002 & 0.074& 0.000\\
\hspace{7pt} $\theta$ & 0.184  & 0.045 & 0.069 & 0.078 & 0.005 & 0.046 & 0.078 & 0.055 \\
    \hspace{7pt} $\delta$ & 0.165  & 0.036 & 0.078 & 0.004 & 0.063& 0.015 & 0.045 & 0.077\\
\addlinespace
$b_k \neq 0$ &     &       &        &       &      &       &       &        \\
\hspace{7pt} $\beta$ & 0.002  & 0.889 & 0.764 & 0.445 & 0.057 & 0.447 & 0.008 & 0.078 \\
\hspace{7pt} $\sigma$ & 0.001  & 0.446 & 0.003 & 0.096 & 0.065 & 0.047 & 0.005 & 0.054\\
\hspace{7pt} $\theta$ & 0.004  & 0.410 & 0.004 & 0.080 & 0.045 & 0.004 & 0.014& 0.036\\
    \hspace{7pt} $\delta$ & 0.005  & 0.780 & 0.002 & 0.070 & 0.052 & 0.046 & 0.051 & 0.065 \\
\bottomrule
   \end{tabular}
    \end{sidewaystable}

However, this is the output:

enter image description here

1
  • 1
    Can you post your MWE from \documentclass{...} to \end{document}
    – MadyYuvi
    Commented Oct 16, 2019 at 10:20

1 Answer 1

3

Your question is not very clear. You already have filled 8 columns and have a header for two more, yet undefined columns. Are this means that you like to have two more? Anyway, you just define number of columns which you like to have and add their data in them:

\documentclass{article}
\usepackage{bm}         % new
\usepackage{rotating}
\usepackage{siunitx}
\usepackage{booktabs, makecell, multirow, threeparttable}
\usepackage{caption}

\usepackage{xparse}     % new
\NewExpandableDocumentCommand\mcc{O{1}m}
    {\multicolumn{#1}{>{\bfseries}c}{#2}}

\begin{document}
    \begin{sidewaystable}
\centering
\caption{Realtime forecast RMSEs for $\bm{h=2Q}$}
\label{forecast}
\begin{threeparttable}
\begin{tabular}{@{}
             >{$}c< {$}
           *{12}{S[table-format=1.3]}   %   <--
                @{}}
    \toprule
\multirow{2.4}{3em}{\bfseries Para- meter} 
    & \mcc[2]{$\bm{S\&P$}\tnote{a}}    
                 & \mcc[2]{GDP\tnote{b}}         
                              & \mcc[2]{Unemploy.}
                                            & \mcc[2]{HPI\tnote{c}}                  \\  
    \cmidrule(l){2-3} \cmidrule(l){4-5}     \cmidrule(l){6-7} 
    \cmidrule(l){8-9} \cmidrule(l){10-11}   \cmidrule(l){12-13}                    
    & \mcc{Mean} & \mcc{RMSE} & \mcc{Mean} & \mcc{RMSE} & \mcc{Mean} & \mcc{RMSE} 
    & \mcc{Mean} & \mcc{RMSE} & \mcc{Mean} & \mcc{RMSE} & \mcc{Mean} & \mcc{RMSE}   \\
    \midrule
b_k = 0 & \mcc[10]{}                                                                \\
\beta   & 0.097  & 0.009 & 0.245 & 0.009 & 0.013 & 0.089 & 0.003 & 0.078 &  &  &  & \\
\sigma  & 0.003  & 0.013 & 0.077 & 0.015 & 0.065 & 0.002 & 0.074 & 0.000 &  &  &  & \\
\theta  & 0.184  & 0.045 & 0.069 & 0.078 & 0.005 & 0.046 & 0.078 & 0.055 &  &  &  & \\
\delta  & 0.165  & 0.036 & 0.078 & 0.004 & 0.063 & 0.015 & 0.045 & 0.077 &  &  &  & \\
\addlinespace
b_k\neq 0   & \mcc[12]{}                                                            \\
\beta   & 0.002  & 0.889 & 0.764 & 0.445 & 0.057 & 0.447 & 0.008 & 0.078 &  &  &  & \\
\sigma  & 0.001  & 0.446 & 0.003 & 0.096 & 0.065 & 0.047 & 0.005 & 0.054 &  &  &  & \\
\theta  & 0.004  & 0.410 & 0.004 & 0.080 & 0.045 & 0.004 & 0.014 & 0.036 &  &  &  & \\
\delta  & 0.005  & 0.780 & 0.002 & 0.070 & 0.052 & 0.046 & 0.051 & 0.065 &  &  &  & \\
    \bottomrule
\end{tabular}
\begin{tablenotes}[para, flushleft]
\item[a] S\&P ...,
\item[b] GDP ...,
\item[c] Hause Price Index.
\end{tablenotes}
\end{threeparttable}
    \end{sidewaystable}
\end{document}

which gives:

enter image description here

In above code I redefine S columns, add threeparttable for use oftablenotesmacro\tnote` for explanation of meaning of shorteness in column headers.

5
  • thanks ,but it seems that your code give me another output , is there a missing package or what?
    – haithem
    Commented Oct 16, 2019 at 12:29
  • There is a \\ missing in line 27. It should actally be & \mcc[2]{HPI\tnote{c}} \\ instead of & \mcc[2]{HPI\tnote{c}}.
    – leandriis
    Commented Oct 16, 2019 at 12:55
  • @haithem: The "different output" you get is generated by code that produces error messages. If you recieve error messages, do not look at the output but add there messages to your request for clarification. Even if you get something that on first glance resembles a pdf file, there can still be issues with it. After an error, TeX only tries to recover enough to syntax check more of the file, it does not try to make sensible output after an error.
    – leandriis
    Commented Oct 16, 2019 at 12:57
  • 1
    @leandriis, you are right. Incidentally I didn't upload the last version of code. Now code is corrected.
    – Zarko
    Commented Oct 16, 2019 at 13:14
  • @haithem, does edited answer solve your problem?
    – Zarko
    Commented Oct 17, 2019 at 14:56

You must log in to answer this question.

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