rstargazertexreg

Getting significance stars from a robust regression model using texreg


texreg, by default at least, doesn't place significance stars on the coefficients from a robust linear model fitted using the rlm function from the MASS package. Is there any way to make it? stargazer does, actually, as the following MWE shows:

library('MASS','stargazer','texreg')

mod <- lm(speed ~ dist, cars)
modR <- rlm(speed ~ dist, cars)

stargazer(mod)
texreg(mod)

stargazer(modR)
texreg(modR)

P.S.: This likely has something to do with the authors of MASS apparently just not liking P-values, as they are conspicuously omitted from the rlm output altogether: https://stats.stackexchange.com/questions/205614/p-values-and-significance-in-rlm-mass-package-r

And yet stargazer can make the stars just fine. Most people seem to think texreg is better, which is the main reason I ask.

P.P.S.: I thought I'd try using lmRob from the robust package instead, but there's an even sillier problem with that: texreg has a method for an object of signature lmrob, but not lmRob, which is what I'm outputting. I assume robust updated and changed this object name but texreg hasn't caught up.


Solution

  • If you look at the code for texreg and follow the "trail of stars" you eventually end up looking at a call to an undocumented ciforce-force function (texreg:::ciforce) whose ci.force-parameter is by default FALSE. Set that to TRUE:

     texreg(modR, ci.force=TRUE)
    
    \begin{table}
    \begin{center}
    \begin{tabular}{l c }
    \hline
     & Model 1 \\
    \hline
    (Intercept) & $8.21^{*}$      \\
                & $[6.46;\ 9.97]$ \\
    dist        & $0.17^{*}$      \\
                & $[0.13;\ 0.20]$ \\
    \hline
    Num. obs.   & 50              \\
    \hline
    \multicolumn{2}{l}{\scriptsize{$^*$ 0 outside the confidence interval}}
    \end{tabular}
    \caption{Statistical models}
    \label{table:coefficients}
    \end{center}
    \end{table}
    

    ... and watch the stars come out.

    Do note that the standard errors in summary(modR) (from MASS) are stated to be used for the construction, not of p-values but rather of t-values.