Getting standard errors for lme4 object with texreg

Jake Fisher

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)

Ben Bolker

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

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Clustered standard errors with texreg?

From Dev

Viewing standard errors and parameter estimates in lme4

From Dev

Viewing standard errors and parameter estimates in lme4

From Dev

R: Strange errors using lmList from lme4

From Dev

Getting the class of the predictors from an lme4 model

From Dev

lme4::lmer summary object contains double object with string

From Dev

lme4::lmer summary object contains double object with string

From Dev

Error : object ‘sigma’ is not exported by 'namespace:lme4'

From Dev

Error : object ‘sigma’ is not exported by 'namespace:lme4'

From Dev

Adjusting object@pp$X in lme4

From Dev

Obtain standard errors of regression coefficients for an "mlm" object returned by `lm()`

From Dev

Obtain standard errors of regression coefficients for an "mlm" object returned by `lm()`

From Dev

Getting errors while converting a string back to CORBA object reference

From Dev

Getting errors while converting a string back to CORBA object reference

From Dev

Getting statsmodels to use heteroskedasticity corrected standard errors in coefficient t-tests

From Dev

test with missing standard errors

From Dev

Plotting standard errors for effects

From Dev

Plotting standard errors for effects

From Dev

Conditional standard deviation and standard errors in Excel

From Dev

How to modify slots lme4 >1.0

From Dev

Convergence error for development version of lme4

From Dev

Setting rhoend parameter with lme4

From Dev

Prediction with lme4 on new levels

From Dev

R stargazer, lme4 and lmerTest incompatibility

From Dev

bootstrapping with lme4 model and missing values

From Dev

lme4 calculate confidence intervals of covariances

From Dev

Setting rhoend parameter with lme4

From Dev

Interpreting glmer confidence interval in lme4

From Dev

Using car:::linearHypothesis() with lme4 models

Related Related

  1. 1

    Clustered standard errors with texreg?

  2. 2

    Viewing standard errors and parameter estimates in lme4

  3. 3

    Viewing standard errors and parameter estimates in lme4

  4. 4

    R: Strange errors using lmList from lme4

  5. 5

    Getting the class of the predictors from an lme4 model

  6. 6

    lme4::lmer summary object contains double object with string

  7. 7

    lme4::lmer summary object contains double object with string

  8. 8

    Error : object ‘sigma’ is not exported by 'namespace:lme4'

  9. 9

    Error : object ‘sigma’ is not exported by 'namespace:lme4'

  10. 10

    Adjusting object@pp$X in lme4

  11. 11

    Obtain standard errors of regression coefficients for an "mlm" object returned by `lm()`

  12. 12

    Obtain standard errors of regression coefficients for an "mlm" object returned by `lm()`

  13. 13

    Getting errors while converting a string back to CORBA object reference

  14. 14

    Getting errors while converting a string back to CORBA object reference

  15. 15

    Getting statsmodels to use heteroskedasticity corrected standard errors in coefficient t-tests

  16. 16

    test with missing standard errors

  17. 17

    Plotting standard errors for effects

  18. 18

    Plotting standard errors for effects

  19. 19

    Conditional standard deviation and standard errors in Excel

  20. 20

    How to modify slots lme4 >1.0

  21. 21

    Convergence error for development version of lme4

  22. 22

    Setting rhoend parameter with lme4

  23. 23

    Prediction with lme4 on new levels

  24. 24

    R stargazer, lme4 and lmerTest incompatibility

  25. 25

    bootstrapping with lme4 model and missing values

  26. 26

    lme4 calculate confidence intervals of covariances

  27. 27

    Setting rhoend parameter with lme4

  28. 28

    Interpreting glmer confidence interval in lme4

  29. 29

    Using car:::linearHypothesis() with lme4 models

HotTag

Archive