Getting standard errors for lme4 object with texreg

I've been using the fantastic package texreg to produce high-quality HTML tables from lme4 models. Unfortunately, by default, texreg creates confidence intervals, rather than standard errors, under the coefficients for models from lme4 (see page 17 of the JSS paper).

As an example:

library(lme4)
library(texreg)
screenreg(lmer(Reaction ~ Days + (Days|Subject), sleepstudy))

produces

Computing profile confidence intervals ...
Computing confidence intervals at a confidence level of 0.95. Use argument "method = 'boot'" for bootstrapped CIs.

===============================================
                               Model 1         
-----------------------------------------------
(Intercept)                     251.41 *       
                               [237.68; 265.13]
Days                             10.47 *       
                               [  7.36;  13.58]
-----------------------------------------------
AIC                            1755.63         
BIC                            1774.79         
Log Likelihood                 -871.81         
Deviance                       1743.63         
Num. obs.                       180            
Num. groups: Subject             18            
Variance: Subject.(Intercept)   612.09         
Variance: Subject.Days           35.07         
Variance: Residual              654.94         
===============================================
* 0 outside the confidence interval

And I would prefer to see something like this:

Computing profile confidence intervals ...
Computing confidence intervals at a confidence level of 0.95. Use argument "method = 'boot'" for bootstrapped CIs.

===============================================
                               Model 1         
-----------------------------------------------
(Intercept)                     251.41 *       
                                (24.74)
Days                             10.47 *       
                                 (5.92)
-----------------------------------------------
[output truncated for clarity]

Is there a way to over-ride this behavior? Using the ci.force = FALSE option doesn't work, as far as I can tell.

I'm sticking with texreg, rather than one of the other packages like stargazer, because texreg allows me to group coefficients into meaningful groups.

Thanks in advance for your help!

(UPDATE: edited to include an example)


Using naive=TRUE gets close to what you want ...

library(lme4); library(texreg)
fm1 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy)
screenreg(fm1,naive=TRUE)

## ==========================================
##                                Model 1    
## ------------------------------------------
## (Intercept)                     251.41 ***
##                                  (6.82)   
## Days                             10.47 ***
##                                  (1.55)   
## ------------------------------------------
## [etc.]

I don't know where you got your values of 24.94, 5.92 from ... ?

sqrt(diag(vcov(fm1)))
## [1] 6.824556 1.545789

cc <- confint(fm1,which="beta_")
apply(cc,1,diff)/3.84
## (Intercept)        Days 
##    7.14813     1.61908

The implied standard errors based on scaling the profile confidence intervals are a little bit wider, but not hugely different.

What I don't know how to do easily is to get significance tests/stars based on profile confidence intervals while still getting standard errors in the table. According to the ci.test entry in ?texreg ,

  • when CIs are printed, texreg prints a single star if the confidence intervals don't include zero
  • when SEs are printed it prints the standard number of stars based on the size of the p-value
  • 链接地址: http://www.djcxy.com/p/25002.html

    上一篇: R:创建没有环境代码的乳胶表

    下一篇: 使用texreg获取lme4对象的标准错误