L. Rodriguez
L. Rodriguez

Reputation: 23

Extract p values and estimates from blmer (list of regression models)?

I have a list of regression models that I created using blmer but I am unable to pull out the p-values as they are not in the anova(model) or using summary(model)$coefficients as I need to pull the p-values for multiple coefficients. Only when it is an lmer model that I have the p-value column available to extract. Is there a separate function or mean to calculate p-values from these regression models from blmer?

Here is an example, except I have a list of models:

m1 = blme::blmer(Y ~ sex + age + (1|id/Group), data=df) 
summary(m1)$coefficients 
anova(m1)

My output does not display a p-value column just t-values which I know is what the lmer models display but when you use summary(model) function on lmer you have a p-value column that is not displayed for blmer.

If I directly format my blmer models as output tables with tab_model for example then I have p-values but at this point it is an html table, is there a way for me to retrieve p-values at the regression coefficient model level for these models?

Upvotes: 1

Views: 1037

Answers (1)

Ben Bolker
Ben Bolker

Reputation: 226162

sjPlot::tab_model calls machinery from the sjstat package, which in turn calls machinery from the parameters package (the p_value function):

library(blme)
data("sleepstudy", package = "lme4")
fm1 <- blmer(Reaction ~ Days + (0 + Days|Subject), sleepstudy,
               cov.prior = gamma)
parameters::p_value(fm1)
##    Parameter            p
##1 (Intercept) 0.000000e+00
##2        Days 8.228424e-08

However: from a statistical point of view I would advise being VERY cautious with these p-values. The help page for ?parameters:p_value says

This function attempts to return, or compute, p-values of a model's parameters. The nature of the p-values is different depending on the model:
• Mixed models (lme4): TO BE IMPROVED.

and below that it indicates that it returns Wald p-values by default. These p-values do not account for:

  • non-quadratic nature of the log-likelihood surface (for which we need likelihood profile CIs)
  • finite-size corrections (for which we need Satterthwaite/Kenward-Roger/"inner-outer" degrees-of-freedom approximations)
  • the effect of the Bayesian priors (whose effect on frequentist p-values hasn't really been studied by anyone to my knowledge, because the question is a mish-mash of Bayesian and frequentist approaches)

Upvotes: 4

Related Questions