【问题标题】:95% CI for the ICC in linear mixed effects model (multilevel model, hierarchical model)ICC 在线性混合效应模型(多级模型、分层模型)中的 95% CI
【发布时间】:2021-10-18 19:42:47
【问题描述】:

我拟合了一个线性混合效应模型来预测数学分数作为结果,x= 参与者因子(名义或序数)作为固定效应,Schl 是随机效应。然后我将它与使用compare_performance 的简单线性回归模型进行比较,虽然输出给出了 ICC,但我不确定如何计算它的 95%? (对于我使用confintconfint 的系数,它完成了工作)

lm1<- lm(math~ gender, data= df)
lme1<- lmer(math~gender+(1|schl), data=df)

compare_performance(lm1,lme1)

ICC 为 0.15

【问题讨论】:

标签: r confidence-interval icc


【解决方案1】:

来自gist from Peter Dahlgren,又来自CrossValidated answer by @Ashe,这里是症结所在:

calc.icc <- function(y) {
  sumy <- summary(y)
  (sumy$varcor$id[1]) / (sumy$varcor$id[1] + sumy$sigma^2)
}
boot.icc <- bootMer(mymod, calc.icc, nsim=1000)
#Draw from the bootstrap distribution the usual 95% upper and lower confidence limits
quantile(boot.icc$t, c(0.025, 0.975))

您可以(并且应该)检查此calc.icc() 函数是否与compare_performance() 函数给出相同的结果。由于这使用参数引导,因此您可以替换任何您喜欢的 ICC 函数,因为它长时间将拟合模型作为输入并将 ICC 作为单个数值返回。 (另外,因为它使用 PB,它会很慢;有可能更快的近似方法,但 PB 可靠且易于编程。)

【讨论】:

    猜你喜欢
    • 2022-12-15
    • 2019-06-28
    • 2017-04-03
    • 2018-07-26
    • 1970-01-01
    • 1970-01-01
    • 2018-11-01
    • 1970-01-01
    • 2015-05-26
    相关资源
    最近更新 更多