0

运行这个glmer.nb,我收到了错误信息

边界(奇异)拟合:参见 ?isSingular

警告消息:在 theta.ml(Y, mu, weights = object@resp$weights, limit = limit, : 达到迭代限制

我跑了singular(model),它又回来了TRUE。然后我跑了summary(model),它显示了警告信息

警告消息:1:在 vcov.merMod(object, use.hessian = use.hessian) 中:从有限差分 Hessian 计算的方差-协方差矩阵不是正定的或包含 NA 值:回退到从 RX 2 估计的 var-cov :在 vcov.merMod(object, correlation = correlation, sigm = sig) 中:从有限差分 Hessian 计算的方差-协方差矩阵不是正定的或包含 NA 值:回退到从 RX 估计的 var-cov

我抬头一看,似乎警告消息表明模型不准确。但我不确定我能做些什么来解决这个警告。我将非常感谢任何帮助!

model <- glmer.nb(Level ~ var1+var2+var3+var4+var5+var6+(1|ID),data = df)
summary(model)
df<-structure(list(ID = c("A", "B", "C", "D", "E", "F", "G", "H", 
"I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", 
"V", "W", "X"), var1 = c(0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 1, 0, 
1, 1, 0, 2, 0, 0, 0, 0, 3, 0, 0, 5), var2 = c(0, 2, 2, 1, 1, 
0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 3, 1, 0, 0), var3 = c(0, 
0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0), var4 = c(0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 1, 0, 0, 0), var5 = c(0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), var6 = c(0, 
0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0), Level = c(1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 
1, 0, 1, 0, 1, 1, 0, 1, 0)), row.names = c(NA, -24L), class = "data.frame")
4

1 回答 1

1

R 对运行零膨胀/负二项式随机效应模型的支持有限,但有一些选项。鉴于评论,我同意@IRTFM 的观点,因为您的数据似乎在重复测量分析中的结构错误 - 请参见此处。您可以重组数据并尝试运行模型,尽管它似乎不能很好地收敛,可能是由于样本量小(尽管它确实产生了结果)。

df.lng <- df %>% pivot_longer(-c(ID, Level), names_to = "repeatedMeasure", values_to = "value")
df.lng[2:ncol(df.lng)] <- lapply(df.lng[1:ncol(df.lng)], as.factor) # convert to factors

# Using lme4 
library(lme4)
model <- glmer.nb(Level ~ repeatedMeasure + (1|ID), data = df.lng)
summary(model)

# Using glmmTMB
library(glmmTMB)
glmmTMB(Level ~ 1 + repeatedMeasure + (1|ID), data = df.lng,
        family = "nbinom2",
        ziformula= ~ 1)
于 2022-01-06T01:40:15.990 回答