1

我想通过使用以下评论获得回归结果的乳胶表;

Analysis1 <- glm(y~x, data=data1, family=quasibinomial(link="logit"))    
summary(Analysis1)
texreg(list(Analysis1),dcolumn = TRUE, booktabs = TRUE,
       use.packages = TRUE, label = "tab:1", 
       caption = "Regression Estimation Results",float.pos = "hb")

然而,这个“texreg”命令给出了原始输出而不是干净的表;

\begin{table}[ht]
\centering
\begin{tabular}{rrrrr}
  \hline
 & Estimate & Std. Error & t value & Pr($>$$|$t$|$) \\ 
  \hline
(Intercept) & 0.7686 & 0.0125 & 61.37 & 0.0000 \\ 
  x & -0.0166 & 0.0069 & -2.41 & 0.0170 \\ 
   \hline
\end{tabular}
\end{table}

您能否帮助我如何通过在 R 中使用 texreg 命令获得干净的回归结果表?

4

1 回答 1

1

您没有提供最小的独立示例。但是,如果我使用glm帮助页面上提供的示例,它似乎确实有效。请参阅以下结果。

library("texreg")  # tested with version 1.33.2

counts <- c(18,17,15,20,10,20,25,13,12)
outcome <- gl(3,1,9)
treatment <- gl(3,3)
Analysis1 <- glm(counts ~ outcome + treatment, family = poisson())

texreg(Analysis1, dcolumn = TRUE, booktabs = TRUE,
    use.packages = TRUE, label = "tab:1", 
    caption = "Regression Estimation Results", float.pos = "hb")

这给出了以下输出,我相信这是正确的。

\usepackage{booktabs}
\usepackage{dcolumn}

\begin{table}[hb]
\begin{center}
\begin{tabular}{l D{.}{.}{3.5}@{} }
\toprule
               & \multicolumn{1}{c}{Model 1} \\
\midrule
(Intercept)    & 3.04^{***} \\
               & (0.17)     \\
outcome2       & -0.45^{*}  \\
               & (0.20)     \\
outcome3       & -0.29      \\
               & (0.19)     \\
treatment2     & 0.00       \\
               & (0.20)     \\
treatment3     & 0.00       \\
               & (0.20)     \\
\midrule
AIC            & 56.76      \\
BIC            & 57.75      \\
Log Likelihood & -23.38     \\
Deviance       & 5.13       \\
Num. obs.      & 9          \\
\bottomrule
\multicolumn{2}{l}{\scriptsize{$^{***}p<0.001$, $^{**}p<0.01$, $^*p<0.05$}}
\end{tabular}
\caption{Regression Estimation Results}
\label{tab:1}
\end{center}
\end{table}

如果您使用相同的代码得到不同的输出,请报告texreg您使用的是哪个版本。如果您使用相同的版本,但您自己的示例产生的结果看起来不同,请提供一个最小的独立示例。

于 2014-09-12T02:02:40.780 回答