我上周用 lmer (lme4) 构建了一个广义混合线性模型,效果很好:
fit<-lmer(dat$presence~log(dat$SIZE_strict)*dat$Troph_level+log(dat$HAB500EXCL_strict+1)+(1|dat$dataset), family=poisson, REML=FALSE)
然而,更新 lme4 包后,模型不再工作,并给出错误消息:
Error in `[[<-.data.frame`(`*tmp*`, i, value = integer(0)) :
replacement has 0 rows, data has 174
In addition: Warning messages:
1: In lmer(dat$presence ~ log(dat$SIZE_strict) * dat$Troph_level + :
calling lmer with 'family' is deprecated; please use glmer() instead
2: In checkArgs("glmer", REML = FALSE) :
extra argument(s) ‘REML’ disregarded
使用 glmer 而不是 lmer 并没有解决第一条错误消息。任何建议将不胜感激!
以下是一些数据(称为 dat):
Troph_level presence dataset SIZE_strict HAB500EXCL_strict
carnivorous 2 1 46155 26005
carnivorous larvae 0 1 46155 26005
phytophagous 2 1 46155 26005
phytophagous 0 3 195295 360882
carnivorous 0 3 195295 360882
carnivorous larvae 0 3 195295 360882
phytophagous 4 2 18272 21169
carnivorous larvae 0 2 18272 21169
carnivorous 1 2 18272 21169
carnivorous 1 2 24964 26745
carnivorous larvae 0 2 24964 26745
phytophagous 4 2 24964 26745
phytophagous 5 2 6220 12543
carnivorous larvae 0 2 6220 12543
carnivorous 1 2 6220 12543
phytophagous 0 3 102633 12198
carnivorous larvae 0 3 102633 12198
carnivorous 0 3 102633 12198
phytophagous 0 3 2092 291439
carnivorous larvae 1 3 2092 291439
carnivorous 0 3 2092 291439
phytophagous 3 5 80410 0
提前谢谢了!图斯·范诺德韦克