二项式GLM中的嵌套数据
在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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论