简体   繁体   中英

How to obtain the p-values for each coefficient in a nested logit glmer model (using lme4)?

I'm running the following code:

library(lme4)
library(nlme)
nest.reg2 <- glmer(SS ~  (bd|cond), family = "binomial", 
    data = combined2)
coef(nest.reg2)
summary(nest.reg2) 

Which produces the following output:

  • coefficients
$cond    
          bd (Intercept)
LL -1.014698    1.286768   
no -3.053920    4.486349
SS -5.300883    8.011879
  • summary
Generalized linear mixed model fit by maximum likelihood (Laplace
  Approximation) [glmerMod]
 Family: binomial  ( logit )
Formula: SS ~ (bd | cond)
   Data: combined2

     AIC      BIC   logLik deviance df.resid 
  1419.7   1439.7   -705.8   1411.7     1084 

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-8.0524 -0.8679 -0.4508  1.0735  2.2756 

Random effects:
 Groups Name        Variance Std.Dev. Corr 
 cond   (Intercept) 33.34    5.774         
        bd          13.54    3.680    -1.00
Number of obs: 1088, groups:  cond, 3

Fixed effects:
            Estimate Std. Error z value Pr(>|z|)  
(Intercept)  -0.3053     0.1312  -2.327     0.02 *

My question is how do I test the significance of each of the coefficients for this model? The Summary function seems to only provide a p-value for the intercept, not the coefficients.

When I try anova(nest.reg2) I get nothing, just:

Analysis of Variance Table
     Df Sum Sq Mean Sq F value

I've tried the solutions proposed here (How to obtain the p-value (check significance) of an effect in a lme4 mixed model?) to no avail.

To clarify, the cond variable is a factor with three levels ( SS , no , and LL ), and I believe that the coef command produces coefficients for the continuous bd variable at each of those levels, so what I'm trying to do is test the significance of those coefficients.

There are several issues here.

  • the main one is that you can really only do significance testing on fixed effect coefficients; you have coded your model with no fixed effects. You might be looking for
glmer(SS ~ bd + (1|cond), ...)

which will model the overall (population-level) distinctions among the levels of bd and include variation in the intercept among levels of cond .

  • If you have multiple levels of bd represented in each cond group, then you can in principle also allow for variation in treatment effects among cond groups:
glmer(SS ~ bd + (bd|cond), ...)
  • however , you have another problem. Three groups (ie, levels of cond ) isn't really enough, in practice, to estimate variability among groups. That's why you're seeing a correlation of -1.00 in your output, which indicates you have a singular fit (eg see here for more discussion).
  • therefore, another possibility would be to just go ahead and treat cond as a fixed effect (adjusting the contrasts on cond so that the main effect of bd is estimated as the average across groups rather than the effect in the baseline level of cond ).
glm(SS~bd*cond,contrasts=list(cond=contr.sum),...)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM