我在尝试使用包glmer
版本1 / 1-7的lme4
函数进行混合效果二项回归时遇到迭代问题。
当我使用代码运行模型时:
model <- glmer(Clinical.signs ~ cloacal +(1|Chicken_ID), family = binomial,
data = viral_load_9)
我收到警告:
错误:pwrssUpdate未收敛(maxit)迭代
当我按照here
给出的建议时使用代码:
model <- glmer(Clinical.signs ~ cloacal +(1|Chicken_ID), family = binomial,
data = viral_load_9,
control=glmerControl(optimizer="bobyqa",
optCtrl = list(maxfun = 100000)))
我仍然有完全相同的错误消息。
我们将非常感激地收到有关我的代码可能出现的问题的任何建议。
遵循aosmith的建议(感谢您的建议!)我包含数据和代码,以便其他人可以复制我得到的结果。请注意,代码适用于变量“oral”并生成“model_1”,但是当我使用变量“cloacal”运行它时,我收到了如上所述的错误消息。
Chicken_ID <- c(44,44,45,45,46,46,47,47,48,48,49,49,50,50,51,51,52,52,53,55,55)
oral <- c(-0.4827578,-0.1845839,-1.3772797,-0.7809318,-0.4827578,1.6044598,0.1135901,0.411764,-0.1845839,1.6044598,-0.1845839,1.6044598,-1.6754536,0.709938,-1.0791057,0.709938,0.1135901,1.0081119,0.411764,-1.6754536,-0.1845839)
cloacal <- c(-0.9833258,0.450691,-1.1267275,0.7374944,-1.1267275,1.0242977,-1.5569325,1.0242977,0.3072893,1.0242977,-0.1229157,1.1676994,-1.5569325,0.5940927,0.450691,0.3072893,-1.1267275,0.7374944,0.1638876,-1.5569325,1.1676994)
clinical.signs <- c("YES","YES","NO","YES","NO","YES","NO","YES","YES","YES","YES","YES","NO","YES","YES","YES","NO","YES","YES","NO","YES")
clinical.signs <- factor(clinical.signs)
viral_load <- data.frame(Chicken_ID, oral, cloacal, clinical.signs)
library(lme4)
model_1 <- glmer(clinical.signs ~ oral +(1|Chicken_ID),
family = binomial, data = viral_load)
summary(model_1)
model_2 <- glmer(clinical.signs ~ cloacal +(1|Chicken_ID),
family = binomial, data = viral_load)
答案 0 :(得分:3)
您的代码可能不是问题。见Q on Cross-Validated。 您可以采取一些措施来防止收敛失败:
glmerControl()