我正在尝试计算毒物分布混合模型的时间自相关,并且想知道如何去做。我收到一个错误消息:“未为该S4类定义$运算符”,我可以在具有泊松分布的线性模型上成功运行dwtest,但不能真正运行我想要的那个。
成功的模型和代码:
temp.nem.cuc.glm<-glm(AllDat$nem.cuc~ AllDat$year.collected, family=poisson(link="log"))
summary(temp.nem.cuc.lm)
time<-AllDat$year.collected
dwnem.cuc<-dwtest(temp.nem.cuc.lm, order.by = time, alternative = "two.sided", iterations = 50, exact = FALSE, tol = 1e-10)
dwnem.cuc
模型和代码失败
#the model I am really interested in
nem.cuc.pois=glmer(nem.cuc~ I(year.collected-1930)+I(standard.length..mm./100) + (1|sites1), family = "poisson", data=AllDat)
time<-AllDat$year.collected
dwnemresid.cuc<-dwtest(nem.cuc.pois, order.by = time, alternative = "two.sided", iterations = 50, exact = FALSE, tol = 1e-10)
dwnem.cuc