我运行了逻辑回归模型,我试图确定随机效应在模型中的重要性。我正在为null和full模型执行此操作,但我将在此处显示null模型。
这是我到目前为止所做的:
> 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
我现在想要确定的是 LRT (以确定ICC与零显着不同)和ICC的CI 。
我尝试使用bootMer创建一个自举分发来计算CI,但我不知道我是否已正确完成它以及结果是否正确。
> 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
如果有人可以请求协助,我们将不胜感激!