二项式GLM中的嵌套数据

发布于 2025-02-10 23:20:08 字数 863 浏览 1 评论 0原文

在3个月内,我评估了不同档案类型的鹿的存在或不存在。 对于每个月,我每个月都在相同的田野中列出了两个区域的四个晚上。因此,总共8晚(A区为A区为4晚,然后为B区4晚,因为彼此之间有遥远的距离) 请参阅图像有关数据的图像 我想看看存在是否取决于区域,月和野战类型。 因此,除了存在之外,我已经将所有内容编码为因素,

data = comp

data$fieldtype<-as.factor(data$fieldtype)
data$zone<-as.factor(data$zone)
data$month<-as.factor(data$month)
data$night<-as.factor(data$night)

但是如果我理解,夜间应该在一个月内嵌套吗? 我已经看到人们只是在做夜晚/月,所以我的glm应该是这样的:

mod3= glm(presence ~ zone +fieldtype + night/month, family= binomial,  data= data)

但是R似乎看到与互动一样,这是正确的吗?我该如何筑巢?而且,我应该将区域作为固定效果吗? 感谢您的帮助。

编辑:夜变量编码是对吗? 对于3月的典范,我参加了A田:11/12/14和A区和18/19/20/21。在我的数据中,我将它们编码为1/2/3/4/4/1/2/3/4是错误的吗?我应该做1/2/3/4/5/6/7/8吗?每个月我应该做1/至32?因为8晚3个月。请注意,每个区域每天晚上我都会做完全相同的轨道,我每天晚上都在相同的领域。 谢谢

I have assessed the presence or not of deer in different filedtype on 2 zone during 3 month.
for each month i have looked a list of the same fields for 4 nights for both zone. So 8 nights in total (4 night for zone A then 4 night for zone B since there are distant from each other)
see image for data exemple
I want to see if the presence depend on the zone, month and fieldtype.
So I have coded everything as factor except presence

data = comp

data$fieldtype<-as.factor(data$fieldtype)
data$zone<-as.factor(data$zone)
data$month<-as.factor(data$month)
data$night<-as.factor(data$night)

but if I understand, night is supposed to be nested in month?
I have seen people just doing night/month so my glm should be like this :

mod3= glm(presence ~ zone +fieldtype + night/month, family= binomial,  data= data)

But R seem to see that as and interaction, is this correct? How can I nest that? And also, should I put zone as a fixed effect?
thanks for your help.

EDIT : is night variable coded right ?
for exemple on march, i went on field : 11/12/13/14 for zone A and 18/19/20/21. in my data i coded them as 1/2/3/4/1/2/3/4 is that wrong ? should i do 1/2/3/4/5/6/7/8 ? and that for each month, or sould i do 1/ to 32 ? because 8 night for 3 month. note that each night for each zone i do the exact same track and i follow each night the same field.
thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文