nesting data in binomial GLM

Viewed 47

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

0 Answers
Related