LillyZoe
LillyZoe

Reputation: 11

How to display more decimals in estimates from lmer() function in R-package lmerTest?

I want to test fixed and random effects with the lmerTest R-package. After defining the model with lmer(), I use summary() to get the results. For my results report, I would like to display more decimals of AIC and BIC, of Variance and Std.Dev in Random Effects, of the Estimate and Std.Error (see picture: my output summary(lmer) with missing/few decimals ).

Things I have already tried out that do not help:

  1. changing general R options
options(digits=3)
  1. changing options within summary() or coef(summary())
summary(lmer, digits=3)
coef(summary(lmer), digits=3)
  1. using round() for summary() or coef(summary())
round(summary(lmer), digits=3)
round(coef(summary(lmer)), digits=3)
  1. searching the terms "digit" and "decimal" in the lmerTest R-package manual

Upvotes: 1

Views: 730

Answers (3)

user22374463
user22374463

Reputation: 1

emm_options(opt.digits = FALSE)

Upvotes: 0

Ben Bolker
Ben Bolker

Reputation: 226627

At present it's not possible to adjust the digit setting for the printing of AIC etc.. You can hack this a bit by using the internal function:

lme4:::.prt.aictab(summary(model)$AICtab, digits = 10)
         AIC          BIC       logLik     deviance     df.resid 
1763.9393445 1783.0970856 -875.9696722 1751.9393445          174 

The global digits option should affect the printing of coef(summary(.)):

options(digits = 10)
coef(summary(model))
                Estimate  Std. Error          df      t value        Pr(>|t|)
(Intercept) 251.40510485 6.632122742 18.00113477 37.907185169 1.263751938e-18

and of the random effects variances:

VarCorr(model)
Groups   Name        Std.Dev.   Corr    
 Subject  (Intercept) 23.7797596         
          Days         5.7167985 0.081321
 Residual             25.5919070   

For extracting components of a mixed model, also see this question and the glance() and tidy() functions from the broom.mixed package.

Upvotes: 1

david
david

Reputation: 100

One way to accomplish this is to load the jtools package and use options( "jtools-digits" = 3 ). When calling your model results, use the summ function to view them.

Upvotes: 1

Related Questions