2

I have run a logistic regression model and I am trying to determine how significant the random effect is in the model. I am doing this for both the null and full models but I will just show the null model here.

Here is what I have so far:

> null_model <- glmer(disease ~ (1|origin), family = binomial(link='logit'), data = mydata)
> summary(null_model) 
Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
 Family: binomial  ( logit )
Formula: disease ~ (1 | origin)
   Data: mydata

     AIC      BIC   logLik deviance df.resid 
   336.1    343.5   -166.0    332.1      294 

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-1.8177 -0.5405 -0.5405  0.9260  2.3248 

Random effects:
 Groups Name        Variance Std.Dev.
 origin (Intercept) 1.47     1.212   
Number of obs: 296, groups:  origin, 22

Fixed effects:
            Estimate Std. Error z value Pr(>|z|)   
(Intercept)  -1.0916     0.3694  -2.955  0.00312 **
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1


> icc(null_model)
Generalized linear mixed model
 Family: binomial (logit)
Formula: disease ~ (1 | origin)

  ICC (origin): 0.308802

What I want to determine now, is the LRT (to determine if the ICC differs significantly from zero) and CIs for the ICC.

I have attempted to create a bootstrapped distribution using bootMer to calculate the CIs but I have no idea as to whether I have done it properly and whether the result is correct.

> calc.icc <- function(y) {
    sumy <- summary(y)
    (sumy$varcor$origin[1]) / (sumy$varcor$origin[1] + sumy$sigma^2)
}

> calc.icc(null_model)

> boot.icc <- bootMer(null_model, calc.icc, nsim=1000)

> quantile(boot.icc$t, c(0.025, 0.975))
        2.5%        97.5% 
1.394684e-12 5.745278e-01 

If someone could please assist it would be greatly appreciated!

Cwilson
  • 21
  • 2
  • When the question is about the applicability or reasonableness You posted this in the wrong place should have been sent to stats.stackexchange.com – IRTFM Mar 07 '22 at 02:30

0 Answers0