lmer output very low P values

182 views Asked by At

I am trying to obtain the P values for a mixed-effect model (m) built with lmer.

I have been using the following commands to extract the P values, but unfortunately I get P=0.0000 for those <10-16. Please see example below:

coefs <- data.frame(coef(summary(m)))
coefs$p.z <- 2 * (1 - pnorm(abs(coefs$t.value)))
coefs

                      Estimate Std..Error    t.value          p.z
(Intercept)        17.32329080 0.39098373 44.3069347 0.000000e+00
variable            0.61802971 0.03804828 16.2433009 0.000000e+00
DietDiet1           1.44932534 0.48893732  2.9642355 3.034360e-03
DietDiet2          18.76067056 0.76890739 24.3991289 0.000000e+00

How can I calculate the extract P values for those?

1

There are 1 answers

0
Ben Bolker On BEST ANSWER

You should be able to use the lower.tail=FALSE argument to compute 1-p more accurately.

coefs$p.z <- 2 * pnorm(abs(coefs$t.value),lower.tail=FALSE)

If you have really small p-values (i.e. <1e-300 rather than <1e-16) you can still compute them on the log-p scale:

logpval <- log(2) + pnorm(abs(coefs$t.value), log.p=TRUE, lower.tail=FALSE)