rglmlme4

How to display the exact p-values instead of < 0.001***?


I conducted a logistic regression and multiple comparison

library(lme4)
model < glmer(y ~ Genger + Age + subject +
    (1 | ParticipantID), data = data, family = binomial(link = "logit"))

library(multcomp)
multicomp<-glht(model,mcp(Behavior="Tukey"))
summary(multicomp)

The output:

                              Estimate  Std. Error  z value Pr(>|z|)    
subject2 - subject1 ==  0 -2.19503726  0.66179761 -2.89596  < 0.001 ***

I want to display the exact p-values instead of < 0.001*** . What should I do?

I tried

options(digits=10)

but the output did not change.


Solution

  • You can change it like this:

    library(lme4)
    data(Orthodont,package="nlme")
    model <-lmer(distance ~ Sex + age + (age|Subject), data=Orthodont)
    
    library(multcomp)
    multicomp<-glht(model, mcp(Sex = "Tukey"))
    res <- summary(multicomp)
    
    print(res)
    #                   Estimate Std. Error z value Pr(>|z|) 
    #Female - Male == 0  -2.1454     0.7575  -2.832  0.00462 **
    
    
    coeftable <- do.call(cbind, res$test[c("coefficients", "sigma", "tstat", "pvalues")])
    colnames(coeftable) <- c("Estimate", "Std. Error", "z value", "Pr(>|z|)")
    
    printCoefmat(coeftable) 
    
    #more digits (but still some protection against showing more digits than meaningful)
    printCoefmat(coeftable, digits = 10) 
    
    #no protection
    print(coeftable)
    
    #even more digits
    options(digits = 20)
    print(coeftable)
    

    However, there is a reason why the exact p-value isn't printed. It is easily impacted by precision of floating-point numbers and also based on statistical assumptions which introduce uncertainty because they don't hold exactly. The multcomp developers are trying to protect you against interpreting meaningless numbers.