Formatting options for large stargazer table

2,808

Everything can be regulated via stargazer. I changed to:

omit.stat = c("f","adj.rsq"), 
font.size = "footnotesize", 
column.sep.width = "1pt", 
single.row = TRUE,
digits=2,
no.space = TRUE

As I don't need the F-Statistic and the adjusted r-square. Changing font to footnotesize is a pretty extreme yet fine solution (for me).

Connected latex code:

\begin{document}
\begin{table}[!htbp] \centering 
\caption{} 
\label{} 
\footnotesize 
\begin{tabular}{@{\extracolsep{1pt}}lcccccc} 
    \\[-1.8ex]\hline 
    \hline \\[-1.8ex] 
    & \multicolumn{6}{c}{\textit{Dependent variable:}} \\ 
    \cline{2-7} 
    \\[-1.8ex] & \multicolumn{6}{c}{Gini} \\ 
    \\[-1.8ex] & (1) & (2) & (3) & (4) & (5) & (6)\\ 
    \hline \\[-1.8ex] 
    Bla1 & $-$2.68$^{**}$ & $-$3.05$^{***}$ & $-$2.78$^{**}$ & $-$2.64$^{**}$ & $-$2.76$^{**}$ & $-$2.36$^{**}$ \\ 
    & p = 0.04 & p = 0.01 & p = 0.03 & p = 0.04 & p = 0.02 & p = 0.05 \\ 
    Bla2 & $-$0.45 & $-$0.61 & $-$0.55 & $-$0.40 & $-$0.52 &  \\ 
    & p = 0.47 & p = 0.29 & p = 0.35 & p = 0.52 & p = 0.37 &  \\ 
    Bla3 &  & 1.35$^{***}$ &  &  & 1.39$^{***}$ & 1.37$^{***}$ \\ 
    &  & p = 0.00 &  &  & p = 0.00 & p = 0.00 \\ 
    Bla4 &  & $-$0.01$^{***}$ &  &  & $-$0.01$^{***}$ & $-$0.01$^{***}$ \\ 
    &  & p = 0.0000 &  &  & p = 0.0000 & p = 0.0000 \\ 
    Bla5 &  & 0.15$^{***}$ &  &  & 0.15$^{***}$ & 0.15$^{***}$ \\ 
    &  & p = 0.00 &  &  & p = 0.00 & p = 0.00 \\ 
    Bla6 &  & $-$3.47 &  &  & $-$3.10 &  \\ 
    &  & p = 0.28 &  &  & p = 0.36 &  \\ 
    Bla7 &  & 0.0001 &  &  & 0.0000 & 0.0001 \\ 
    &  & p = 0.33 &  &  & p = 0.77 & p = 0.26 \\ 
    Bla8 &  & 0.01 &  &  & 0.01 &  \\ 
    &  & p = 0.20 &  &  & p = 0.15 &  \\ 
    Bla9 &  &  & 0.0000 &  & 0.0000 &  \\ 
    &  &  & p = 0.46 &  & p = 0.41 &  \\ 
    Bla10 &  &  & 0.11$^{**}$ &  & 0.04 & 0.04 \\ 
    &  &  & p = 0.02 &  & p = 0.39 & p = 0.31 \\ 
    Bla11 &  &  & 0.001 &  & $-$0.10$^{***}$ & $-$0.10$^{***}$ \\ 
    &  &  & p = 0.97 &  & p = 0.0003 & p = 0.0004 \\ 
    Bla12 &  &  & $-$5.62 &  & $-$3.19 &  \\ 
    &  &  & p = 0.49 &  & p = 0.66 &  \\ 
    Bla13 &  &  & $-$11.63$^{**}$ &  & $-$10.07$^{**}$ & $-$10.30$^{**}$ \\ 
    &  &  & p = 0.03 &  & p = 0.05 & p = 0.05 \\ 
    Bla14 &  &  &  & $-$0.001 & $-$0.01 &  \\ 
    &  &  &  & p = 0.99 & p = 0.79 &  \\ 
    Bla15 &  &  &  & $-$0.12 & $-$0.15 &  \\ 
    &  &  &  & p = 0.54 & p = 0.42 &  \\ 
    Bla16 &  &  &  & $-$0.02$^{*}$ & $-$0.02 & $-$0.02 \\ 
    &  &  &  & p = 0.09 & p = 0.17 & p = 0.16 \\ 
    \hline \\[-1.8ex] 
    Observations & 2,408 & 2,408 & 2,408 & 2,408 & 2,408 & 2,408 \\ 
    R$^{2}$ & 0.004 & 0.17 & 0.01 & 0.01 & 0.18 & 0.18 \\ 
    \hline 
    \hline \\[-1.8ex] 
    \textit{Note:}  & \multicolumn{6}{r}{$^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01} \\ 
\end{tabular} 
\end{table} 
\end{document}
Share:
2,808

Related videos on Youtube

BeSeLuFri
Author by

BeSeLuFri

Econ Student and R-Newbie.

Updated on August 01, 2022

Comments

  • BeSeLuFri
    BeSeLuFri over 1 year

    I am new to latex and I am trying to get a standard albeit large stargazer table into my paper. My goal is that the table is still centered but a bit larger then the text size. I want to maximize readeability. I want to keep it on a normal A4 paper.

    \documentclass{article}
    \begin{document}
    
    \begin{table}[!htbp] \centering 
        \caption{Stepwise Covering Periods} 
        \label{} 
        \begin{tabular}{@{\extracolsep{5pt}}lcccccc} 
            \\[-1.8ex]\hline 
            \hline \\[-1.8ex] 
            & \multicolumn{6}{c}{\textit{Dependent variable:}} \\ 
            \cline{2-7} 
            \\[-1.8ex] & \multicolumn{6}{c}{Gini} \\ 
            \\[-1.8ex] & (1) & (2) & (3) & (4) & (5) & (6)\\ 
            \hline \\[-1.8ex] 
            Bla1 & $-$3.361$^{***}$ & $-$2.875$^{***}$ & $-$3.212$^{***}$ & $-$3.077$^{***}$ & $-$2.826$^{***}$ & $-$2.291$^{**}$ \\ 
            & p = 0.003 & p = 0.007 & p = 0.004 & p = 0.006 & p = 0.007 & p = 0.035 \\ 
            & & & & & & \\ 
            Bla2 & $-$1.391$^{**}$ & $-$0.587 & $-$1.258$^{**}$ & $-$1.187$^{**}$ & $-$0.617 &  \\ 
            & p = 0.016 & p = 0.271 & p = 0.021 & p = 0.038 & p = 0.251 &  \\ 
            & & & & & & \\ 
            Bla3 &  & 1.378$^{***}$ &  &  & 1.423$^{***}$ & 1.401$^{***}$ \\ 
            &  & p = 0.000 &  &  & p = 0.000 & p = 0.000 \\ 
            & & & & & & \\ 
            Bla4 &  & $-$0.015$^{***}$ &  &  & $-$0.015$^{***}$ & $-$0.015$^{***}$ \\ 
            &  & p = 0.000 &  &  & p = 0.000 & p = 0.000 \\ 
            & & & & & & \\ 
            Bla5 &  & 0.167$^{***}$ &  &  & 0.161$^{***}$ & 0.164$^{***}$ \\ 
            &  & p = 0.000 &  &  & p = 0.000 & p = 0.000 \\ 
            & & & & & & \\ 
            Bla6 &  & $-$3.343 &  &  & $-$3.531 &  \\ 
            &  & p = 0.256 &  &  & p = 0.235 &  \\ 
            & & & & & & \\ 
            Bla7 &  & 0.0001 &  &  & 0.0001 & 0.0001$^{*}$ \\ 
            &  & p = 0.252 &  &  & p = 0.272 & p = 0.099 \\ 
            & & & & & & \\ 
            Bla8 &  & 0.010$^{*}$ &  &  & 0.010$^{**}$ &  \\ 
            &  & p = 0.055 &  &  & p = 0.043 &  \\ 
            & & & & & & \\ 
            Bla9 &  &  & 0.00000$^{**}$ &  & 0.00000 &  \\ 
            &  &  & p = 0.012 &  & p = 0.664 &  \\ 
            & & & & & & \\ 
            Bla10 &  &  & 0.186$^{***}$ &  & 0.059 & 0.064 \\ 
            &  &  & p = 0.00001 &  & p = 0.138 & p = 0.116 \\ 
            & & & & & & \\ 
            Bla11 &  &  & 0.053$^{**}$ &  & $-$0.104$^{***}$ & $-$0.103$^{***}$ \\ 
            &  &  & p = 0.027 &  & p = 0.00004 & p = 0.00004 \\ 
            & & & & & & \\ 
            Bla12 &  &  & 1.787 &  & $-$1.317 &  \\ 
            &  &  & p = 0.797 &  & p = 0.834 &  \\ 
            & & & & & & \\ 
            Bla13 &  &  & $-$8.749$^{*}$ &  & $-$9.166$^{*}$ & $-$9.367$^{*}$ \\ 
            &  &  & p = 0.081 &  & p = 0.056 & p = 0.053 \\ 
            & & & & & & \\ 
            Bla14 &  &  &  & $-$0.101$^{**}$ & $-$0.002 &  \\ 
            &  &  &  & p = 0.012 & p = 0.963 &  \\ 
            & & & & & & \\ 
            Bla15 &  &  &  & 0.271$^{*}$ & $-$0.066 &  \\ 
            &  &  &  & p = 0.070 & p = 0.628 &  \\ 
            & & & & & & \\ 
            Bla16 &  &  &  & $-$0.001 & 0.003 & 0.004 \\ 
            &  &  &  & p = 0.889 & p = 0.383 & p = 0.287 \\ 
            & & & & & & \\ 
            Bla17 & 0.028 & $-$0.484$^{***}$ & $-$0.083 & $-$0.061 & $-$0.512$^{***}$ & $-$0.530$^{***}$ \\ 
            & p = 0.784 & p = 0.00001 & p = 0.430 & p = 0.728 & p = 0.002 & p = 0.00003 \\ 
            & & & & & & \\ 
            Bla18 & 0.935$^{***}$ & $-$0.116 & 0.512$^{***}$ & 0.575$^{***}$ & 0.049 & 0.061 \\ 
            & p = 0.000 & p = 0.390 & p = 0.0002 & p = 0.003 & p = 0.808 & p = 0.667 \\ 
            & & & & & & \\ 
            \hline \\[-1.8ex] 
            Observations & 2,408 & 2,408 & 2,408 & 2,408 & 2,408 & 2,408 \\ 
            R$^{2}$ & 0.095 & 0.270 & 0.114 & 0.101 & 0.282 & 0.280 \\ 
            Adjusted R$^{2}$ & $-$0.024 & 0.173 & $-$0.005 & $-$0.018 & 0.183 & 0.182 \\ 
            F Statistic & 62.914$^{***}$ (df = 4; 2404) & 88.908$^{***}$ (df = 10; 2398) & 34.175$^{***}$ (df = 9; 2399) & 38.599$^{***}$ (df = 7; 2401) & 52.253$^{***}$ (df = 18; 2390) & 84.546$^{***}$ (df = 11; 2397) \\ 
            \hline 
            \hline \\[-1.8ex] 
            \textit{Note:}  & \multicolumn{6}{r}{$^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01} \\ 
        \end{tabular} 
    \end{table} 
    
    \end{document}
    
    • Bernard
      Bernard over 5 years
      Welcome to TeX SX! You probably should use longtable.
    • leandriis
      leandriis over 5 years
      Fitting the table onto a single page is most likely impossible, especially, if you want to 'maximize readability' and only want the table to be 'a bit larger then the text size'. You coud either split the table into two (one that shows the columns labelled (1)-(3) and another table for the remaining columns) or consider rotating the whole table to allow it to be wider. Redesigning the contents of the 'F Statistic' row might additionally help.
    • Fran
      Fran over 5 years
      Do you really need three decimals? And show both the starts and p values? And show "p=" in every cell instead of simply "p value" in first column? Another idea to gain space: highlight significant cells by colors instead of starts.