我正在使用单一随机变量(使用glmer)进行混合效应逻辑回归模型,我正在努力寻找一种方法来产生预测概率和相应的95%CI。我已经能够使用以下类型的代码为固定效果模型执行此操作:
Call:
glm(formula = survive/trials ~ class, family = binomial(logexp(vespdata$expos)),
data = vespdata)
Deviance Residuals:
Min 1Q Median 3Q Max
-2.6823 0.2621 0.4028 0.4540 0.6935
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 4.6774 0.5796 8.069 7.07e-16 ***
class2 -1.3236 0.6957 -1.903 0.0571 .
class3 -0.5751 0.9170 -0.627 0.5306
class4 -1.0806 0.9217 -1.172 0.2411
class5 -1.2889 0.6564 -1.964 0.0496 *
class6 -1.5379 0.6508 -2.363 0.0181 *
class8 -1.2078 0.6957 -1.736 0.0825 .
vesppredict2 = with(vespdata, data.frame(class = gl(7,1))
vesppredict2 = cbind(vesppredict2, predict(vespclass.exp, newdata = vesppredict2,
type = "link", se = TRUE))
vesppredict2 = within(vesppredict2,
{PredictedProb = (plogis(fit))^23
LL = (plogis(fit - (1.96 * se.fit)))^23
UL = (plogis(fit + (1.96 * se.fit)))^23
ErrorBar = (UL-PredictedProb)
})
我遇到的问题是predict()
不能将参数se = TRUE
用于混合效果模型。我尝试添加参数re.form = NA
,但无济于事。我会很感激任何提示!