投影机里放不下桌子

投影机里放不下桌子

这是我在 R 中执行的 stargazer 包的输出。但是,我无法使表格适合我的 beamer 演示文稿。

以下是代码:

% Table created by stargazer v.5.2.2 by Marek Hlavac, Harvard University. E-mail: hlavac at fas.harvard.edu
% Date and time: dom, nov 24, 2019 - 17:40:05
\begin{table}[!htbp] \centering 
  \caption{Tabela 1} 
  \label{} 
\begin{tabular}{@{\extracolsep{5pt}}lccccccccc} 
\\[-1.8ex]\hline 
\hline \\[-1.8ex] 
 & \multicolumn{9}{c}{Variável dependete} \\ 
\cline{2-10} 
\\[-1.8ex] & \multicolumn{9}{c}{Anos de estudo (25 anos ou mais)} \\ 
\\[-1.8ex] & (1) & (2) & (3) & (4) & (5) & (6) & (7) & (8) & (9)\\ 
\hline \\[-1.8ex] 
 Percentual de domicilios com abastecimento de água potável & 0.739$^{***}$ & 0.287$^{***}$ & 0.308$^{***}$ & 0.286$^{***}$ & 0.196$^{***}$ & 0.203$^{***}$ & 0.136$^{***}$ & 0.196$^{***}$ & 0.332$^{***}$ \\ 
  & (0.027) & (0.028) & (0.027) & (0.028) & (0.025) & (0.023) & (0.040) & (0.024) & (0.022) \\ 
  & & & & & & & & & \\ 
 Analfabestismo &  & $-$0.247$^{***}$ & $-$0.246$^{***}$ & $-$0.216$^{***}$ & $-$0.202$^{***}$ & $-$0.215$^{***}$ & $-$0.170$^{***}$ & $-$0.201$^{***}$ & $-$0.249$^{***}$ \\ 
  &  & (0.012) & (0.011) & (0.016) & (0.013) & (0.013) & (0.023) & (0.016) & (0.018) \\ 
  & & & & & & & & & \\ 
 População &  &  & $-$0.024$^{***}$ & $-$0.026$^{***}$ & $-$0.042$^{***}$ & $-$0.036$^{***}$ & $-$0.617$^{***}$ & $-$0.013$^{***}$ & $-$0.140$^{***}$ \\ 
  &  &  & (0.004) & (0.004) & (0.004) & (0.004) & (0.198) & (0.005) & (0.043) \\ 
  & & & & & & & & & \\ 
 Renda per capita &  &  &  & 0.049$^{***}$ & 0.067$^{***}$ & 0.052$^{***}$ & 0.031 & 0.143$^{***}$ & 0.115$^{***}$ \\ 
  &  &  &  & (0.019) & (0.016) & (0.015) & (0.042) & (0.017) & (0.030) \\ 
  & & & & & & & & & \\ 
 Gasto em saúde e saneamento &  &  &  &  & 0.021$^{***}$ & 0.062$^{***}$ & 0.005 & 0.003 & $-$0.003 \\ 
  &  &  &  &  & (0.002) & (0.006) & (0.005) & (0.007) & (0.006) \\ 
  & & & & & & & & & \\ 
 Gasto em educação e cultura &  &  &  &  &  & $-$0.045$^{***}$ & $-$0.004 & $-$0.003 & 0.001 \\ 
  &  &  &  &  &  & (0.007) & (0.005) & (0.007) & (0.005) \\ 
  & & & & & & & & & \\ 
 Tendência (estado*ano) & 0.833$^{***}$ & 1.056$^{***}$ & 1.217$^{***}$ & 1.143$^{***}$ & 1.031$^{***}$ & 1.064$^{***}$ & $-$12.271$^{***}$ & $-$5.278$^{***}$ &  \\ 
  & (0.004) & (0.011) & (0.029) & (0.040) & (0.035) & (0.033) & (4.286) & (1.481) &  \\ 
  & & & & & & & & & \\ 
\hline \\[-1.8ex] 
Efeito fixo de ano & Não & Não & Não & Não & Não & Não & Não & Não & Sim \\ 
Efeito fixo de estado & Não & Não & Não & Não & Não & Não & Não & Não & Sim \\ 
Efeito fixo de região & Não & Não & Não & Não & Não & Não & Não & Não & Sim \\ 
Observations & 378 & 378 & 378 & 378 & 378 & 378 & 378 & 378 & 378 \\ 
R$^{2}$ & 0.660 & 0.844 & 0.857 & 0.860 & 0.904 & 0.914 & 0.984 & 0.941 & 1.000 \\ 
Adjusted R$^{2}$ & 0.659 & 0.843 & 0.856 & 0.859 & 0.903 & 0.913 & 0.981 & 0.939 & 1.000 \\ 
Residual Std. Error & 0.057 (df = 376) & 0.039 (df = 375) & 0.037 (df = 374) & 0.037 (df = 373) & 0.031 (df = 372) & 0.029 (df = 371) & 0.013 (df = 318) & 0.024 (df = 362) & 0.016 (df = 344) \\ 
F Statistic & 729.946$^{***}$ (df = 1; 376) & 1,014.397$^{***}$ (df = 2; 375) & 749.786$^{***}$ (df = 3; 374) & 572.904$^{***}$ (df = 4; 373) & 699.079$^{***}$ (df = 5; 372) & 660.077$^{***}$ (df = 6; 371) & 335.396$^{***}$ (df = 59; 318) & 387.991$^{***}$ (df = 15; 362) & 23,712.990$^{***}$ (df = 34; 344) \\ 
\hline 
\hline \\[-1.8ex] 
\textit{Note:}  & \multicolumn{9}{r}{$^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01} \\ 
\end{tabular} 
\end{table} 

答案1

在我详细说明如何调整表格以使其(部分)合适之前,我想问您以下问题:您到底想通过向观众展示一张包含 9 个数据列和 7 个主要数据行(总共 108 个数字,包括所有标准错误)的表格来实现什么目的?您指望他们记住哪怕一个数字吗?如果不是,为什么您甚至考虑向观众提供他们不可能接受的信息?或者,您真的希望观众记住您是一个以向观众展示无意义的数字为乐的男人(女人?)吗?我希望您对最后一个问题的回答是肯定的“不”。

无论如何,表格中的信息实在太多,无法容纳在 beamer 页面中。您必须在很多地方进行削减。首先,我建议删除所有自由度数字(这些是您的观众真正最关心的,不是吗?)和所有星号。并且,切换到\tiny,减少 的值\tabcolsep,减少行间距的浪费,并且不要使用环境table

通过所有这些调整,可以(但仅仅是)使表格适合页面大小。

在此处输入图片描述

% !TEX TS-program = pdflatex
\documentclass{beamer}
\usepackage[portuguese]{babel}
\usepackage{tabularx,booktabs,ragged2e}
\newcolumntype{L}{>{\RaggedRight\arraybackslash}X}

\begin{document}
\begin{frame}{Tabela 1}
\setlength\tabcolsep{2pt}
\tiny
\begin{tabularx}{\textwidth}{@{} L *{9}{c} @{}} 
\toprule
& \multicolumn{9}{c}{Variável dependete: Anos de estudo (25 anos ou mais)} \\ 
\cmidrule(l){2-10} 
& (1) & (2) & (3) & (4) & (5) & (6) & (7) & (8) & (9)\\ 
\midrule
\smash[b]{\begin{tabular}[t]{@{}p{\hsize}@{}}
  \raggedright Percentual de domicilios com abastecimento de água potável
\end{tabular}}
     & 0.739 & 0.287 & 0.308 & 0.286 & 0.196 & 0.203 & 0.136 & 0.196 & 0.332 \\ 
     & (0.027) & (0.028) & (0.027) & (0.028) & (0.025) & (0.023) & (0.040) & (0.024) & (0.022) \\     
 Analfabestismo & & $-$0.247 & $-$0.246 & $-$0.216 & $-$0.202 & $-$0.215 & $-$0.170 & $-$0.201 & $-$0.249 \\ 
     & & (0.012) & (0.011) & (0.016) & (0.013) & (0.013) & (0.023) & (0.016) & (0.018) \\     
 População & & & $-$0.024 & $-$0.026 & $-$0.042 & $-$0.036 & $-$0.617 & $-$0.013 & $-$0.140 \\ 
     & & & (0.004) & (0.004) & (0.004) & (0.004) & (0.198) & (0.005) & (0.043) \\     
 Renda per capita & & & & 0.049 & 0.067 & 0.052 & 0.031 & 0.143 & 0.115 \\ 
     & & & & (0.019) & (0.016) & (0.015) & (0.042) & (0.017) & (0.030) \\     
 Gasto em saúde e saneamento & & & & & 0.021 & 0.062 & 0.005 & 0.003 & $-$0.003 \\ 
     & & & & & (0.002) & (0.006) & (0.005) & (0.007) & (0.006) \\     
 Gasto em educação e cultura & & & & & & $-$0.045 & $-$0.004 & $-$0.003 & 0.001 \\ 
     & & & & & & (0.007) & (0.005) & (0.007) & (0.005) \\    
 Tendência (estado$\times$ano) & 0.833 & 1.056 & 1.217 & 1.143 & 1.031 & 1.064 & $-$12.27 & $-$5.278 & \\ 
     & (0.004) & (0.011) & (0.029) & (0.040) & (0.035) & (0.033) & (4.286) & (1.481) & \\ 
\midrule
Efeito fixo de ano & Não & Não & Não & Não & Não & Não & Não & Não & Sim \\ 
Efeito fixo de estado & Não & Não & Não & Não & Não & Não & Não & Não & Sim \\ 
Efeito fixo de região & Não & Não & Não & Não & Não & Não & Não & Não & Sim \\ 
Observations & 378 & 378 & 378 & 378 & 378 & 378 & 378 & 378 & 378 \\ 
\smash{R\textsuperscript{2}} & 0.660 & 0.844 & 0.857 & 0.860 & 0.904 & 0.914 & 0.984 & 0.941 & 1.000 \\ 
Adjusted \smash{R\textsuperscript{2}} & 0.659 & 0.843 & 0.856 & 0.859 & 0.903 & 0.913 & 0.981 & 0.939 & 1.000 \\ 
Residual Std.\ Error & 0.057 & 0.039 & 0.037 & 0.037 & 0.031 & 0.029 & 0.013 & 0.024 & 0.016 \\ 
F Statistic & 729.9 & 1,014.4 & 749.8 & 572.9 & 699.1 & 660.1 & 335.4 & 388.0 & 23,713 \\ 
\bottomrule
%\addlinespace
%\multicolumn{10}{@{}l}{\textit{Note:} $^{*}\,p<0.1$; $^{**}\,p<0.05$; $^{***}\,p<0.01$} \\ 
\end{tabularx} 

\end{frame}
\end{document}

附录并提供了一些关于如何使您的表格更易于阅读的额外建议。

  • 似乎有些事情不对劲最后一栏:简单和调整后的 R 平方统计量都等于 1,回归 F 统计量的值简直是天文数字。(顺便说一句,我是一名计量经济学家。)在我看来,您在回归中犯了一个错误;我的直觉是,通过包括一整套年龄、州和地区固定效应,您成功地让回归“解释”了因变量的整个方差。结果是什么?除非您能找出问题所在并纠正错误,否则您几乎肯定会完全省略最后一列。

  • 由于每个回归分析都基于成百上千的观测值,因此简单和调整后的 R 平方统计值非常接近。同时报告两者是一种冗余行为。为了不侮辱读者的智商,请不要显示两个都统计数据。

  • 所有回归 F 统计量都高度显著。事实上,它们是如此显著,以至于单独显示它们没有任何明显的意义。一个简单的句子,其中提到所有 F 统计量都是显著的,应该很容易就足够了。

  • 同样,我看不出显示“残差标准误差”行的任何理由。

  • 由于每个回归都有相同数量的基础观测值,,378,用整整一行来强调这个并不十分令人兴奋的事实似乎毫无意义。只需在图例中提到所有回归都基于 378 个观察结果;这对您的读者来说会更有帮助。

  • 如果可以去掉可疑的最后一列,那么将有足够的空间将剩余 8 个数据列中的数字对齐到各自的小数点标记上。

  • 仍然讨论如何删除可疑的最后一列:如果你可以删除它,你可以删除另外三行:这些行将显示其他 8 个回归都不包含任何固定效应回归量。

  • 我上面提到,省略表示显著性的星号的一个令人信服的原因是,根本没有空间放置它们。不显示星号的第二个令人信服的原因是,在系数显著的每个实例中,都有总是三个星号;没有一个系数具有一个或两个星号的重要性。因此,用单个星号标记系数(并调整图例以宣布单个星号表示在 1% 水平上的重要性)应该足够了。显示一个星号而不是三个星号确实会减少视觉混乱。但是,我根本不会走星号路线。如果你只是必须为了突出某些系数的事实,我建议您通过将单元格涂成蓝色(或紫色,如果您愿意)来实现。

在此处输入图片描述

% !TEX TS-program = pdflatex
\documentclass[table]{beamer}
\usepackage[portuguese]{babel}
\usepackage{tabularx,booktabs,ragged2e,siunitx,}
\newcolumntype{L}{>{\RaggedRight\arraybackslash}X}
\usepackage{xcolor} % for '\color' and '\textcolor' macros

\newcommand\CC{\color{blue}}

\begin{document}
\begin{frame}{Tabela 1}
\setlength\tabcolsep{2pt}
\sisetup{input-symbols         = ( ), 
         table-space-text-post = ),
         table-format          = -1.3}
\tiny
\begin{tabularx}{\textwidth}{@{} L *{8}{S} @{}} 
\toprule
& \multicolumn{8}{c@{}}{Variável dependete: Anos de estudo (25 anos ou mais)} \\ 
\cmidrule(l){2-9} 
& {(1)} & {(2)} & {(3)} & {(4)} & {(5)} & {(6)} & {(7)} & {(8)} \\ 
\midrule
\smash[b]{\begin{tabular}[t]{@{}p{\hsize}@{}}
  \raggedright Percentual de domicilios com abastecimento de água potável
\end{tabular}}
     &\CC0.739 &\CC0.287 &\CC0.308 &\CC0.286 &\CC0.196 &\CC0.203 &\CC0.136 &\CC0.196\\ 
     & (0.027) & (0.028) & (0.027) & (0.028) & (0.025) & (0.023) & (0.040) & (0.024)\\ 
\addlinespace    
 Analfabestismo & &\CC-0.247 &\CC-0.246 &\CC-0.216 &\CC-0.202 &\CC-0.215 &\CC-0.170 &\CC-0.201\\ 
     & & (0.012) & (0.011) & (0.016) & (0.013) & (0.013) & (0.023) & (0.016)\\     
\addlinespace    
 População & & &\CC-0.024 &\CC-0.026 &\CC-0.042 &\CC-0.036 &\CC-0.617 &\CC-0.013\\ 
     & & & (0.004) & (0.004) & (0.004) & (0.004) & (0.198) & (0.005)\\     
\addlinespace    
 Renda per capita & & & &\CC0.049 &\CC0.067 &\CC0.052 & 0.031 &\CC0.143\\ 
     & & & & (0.019) & (0.016) & (0.015) & (0.042) & (0.017)\\     
\addlinespace    
 Gasto em saúde e saneamento & & & & &\CC0.021 &\CC0.062 & 0.005 & 0.003\\ 
     & & & & & (0.002) & (0.006) & (0.005) & (0.007)\\     
\addlinespace    
 Gasto em educação e cultura & & & & & &\CC-0.045 & -0.004 & -0.003\\ 
     & & & & & & (0.007) & (0.005) & (0.007)\\    
\addlinespace    
 Tendência (estado$\times$ano) &\CC0.833 &\CC1.056 &\CC1.217 &\CC1.143 &\CC1.031 &\CC1.064 &\CC-12.271 &\CC-5.278\\ 
     & (0.004) & (0.011) & (0.029) & (0.040) & (0.035) & (0.033) & (4.286) & (1.481)\\ 
\midrule
R\textsuperscript{2} & 0.660 & 0.844 & 0.857 & 0.860 & 0.904 & 0.914 & 0.984 & 0.941\\ 
\bottomrule
\addlinespace
\multicolumn{9}{@{}p{\textwidth}@{}}{Number of observations for all regressions: 378. No age, state[estado?], or region fixed effects. Coefficients colored in \textcolor{blue}{blue} are statistically significant at the 1\% level. All regression F-statistics are statistically significant at the 1\% level.}\\ 
\end{tabularx} 

\end{frame}
\end{document}

相关内容