简体   繁体   English

运行泊松问题 model

[英]issue with running poisson model

I am trying to run a Poisson model in R. I checked a number of web sites to do this and I believe the code below should work.我正在尝试在 R 中运行 Poisson model。我检查了许多 web 站点来执行此操作,我相信下面的代码应该有效。 However, I am getting an error message that indicates that there is an unused argument.但是,我收到一条错误消息,指出存在未使用的参数。 I don't understand what the issue is.我不明白这是什么问题。

library(lme4)
m1<-lmer(sum ~ Lunch + intervention_y_n + (1 | prcid), 
         data=data_long_1, family = "poisson"(link = "log"))

Error in lmer(sum ~ Lunch + intervention_y_n + (1 | prcid), data = data_long_1, : unused argument (family = poisson(link = "log")) lmer 错误(sum ~ Lunch + intervention_y_n + (1 | prcid), data = data_long_1, : unused argument (family = poisson(link = "log"))

You need glmer() for generalized linear mixed models (eg a Poisson model).对于广义线性混合模型(例如泊松模型),您需要glmer() ) 。 lmer() is for linear mixed models only (Gaussian response with an identity link), so it doesn't have a family argument. lmer()仅适用于线性混合模型(具有身份链接的高斯响应),因此它没有family参数。

This code worked until fairly recently (4 months ago).此代码直到最近(4 个月前)才有效。 If you check the NEWS file for lme4 you'll see that version 1.1-22, which was released in April 2020, disabled the automatic forwarding of lmer(..., family=...) to glmer .如果您查看lme4 的新闻文件,您会看到 2020 年 4 月发布的版本 1.1-22 禁用了lmer(..., family=...)glmer的自动转发。 However, this usage had been deprecated (ie, gave a warning message telling you not to use it) starting in 2013...但是,从 2013 年开始,这种用法已被弃用(即发出警告消息告诉您不要使用它)...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM