# Am I statistically allowed to use a binomial family here -> is my data truly independent?

I'm having trouble with finding the most suitable analysis for my data. I'm investigating the behaviour of wild animals in nature. More specifically, I'm looking at animals scavenging from carcasses left out in nature and whether or not the animal is a bird or mammal (no other possibilities). So I basically watched video's of all the animals and behaviours at the 34 carcasses, then filtered for only animals performing a scavenging event. Then I counted the number of birds and mammals per carcass performing such a scavenging event, so basically: is the animal a bird (YES/NO)? Because the data were taken from different national parks, I use Area as a random effect.

The idea is that I want to test the effect of overhead cover on the proportion bird/mammal. Data to reproduce:

df_prop_birds_eating <- data.frame(Birds = c(2, 111, 10, 0, 0, 1, 12, 80, 58, 21, 34, 185, 2, 19, 66, 0, 4, 15, 360, 9, 54, 253, 67, 37, 1, 0, 0, 0, 0, 78, 38, 183, 1, 0),
Mammals = c(5, 154, 6, 104, 11, 34, 44, 31, 40, 4, 3, 203, 91, 33, 68, 105, 151, 50, 107, 9, 0, 0, 1, 31, 9, 29, 195, 143, 304, 496, 422, 136, 131, 64),
ProportionBirdsScavenging = c(0.292016806722689, 0.421254162042175, 0.621323529411765, 0.0147058823529412, 0.0147058823529412, 0.042436974789916, 0.222689075630252, 0.71422893481717, 0.589135654261705, 0.83, 0.906597774244833, 0.477486355366889, 0.0355787476280835, 0.369343891402715, 0.492756804214223, 0.0147058823529412, 0.039753320683112, 0.23868778280543, 0.762910945962968, 0.5, 0.985294117647059, 0.985294117647059, 0.971020761245675, 0.542820069204152, 0.111764705882353, 0.0147058823529412, 0.0147058823529412, 0.0147058823529412, 0.0147058823529412, 0.146597663455626, 0.0948849104859335, 0.571501014198783, 0.0220588235294118, 0.0147058823529412),
pointWeight = c(7, 265, 16, 104, 11, 35, 56, 111, 98, 25, 37, 388, 93, 52, 134, 105, 155, 65, 467, 18, 54, 253, 68, 68, 10, 29, 195, 143, 304, 574, 460, 319, 132, 64),
pointWeight_scaled = c(0.0000001, 0.45502650952381, 0.0158731142857143, 0.171075920634921, 0.00705477301587302, 0.0493828111111111, 0.0864198444444444, 0.183421598412698, 0.160493911111111, 0.0317461285714286, 0.0529101476190476, 0.671957704761905, 0.15167556984127, 0.0793651714285714, 0.223985968253968, 0.172839588888889, 0.261023001587302, 0.102292858730159, 0.811287496825397, 0.0194004507936508, 0.0828925079365079, 0.43386249047619, 0.107583863492063, 0.107583863492063, 0.00529110476190476, 0.0388008015873016, 0.331569731746032, 0.239858982539683, 0.523809571428571, 1, 0.798941819047619, 0.550264595238095, 0.220458631746032, 0.10052919047619),
OverheadCover = c(0.7, 0.671, 0.6795, 0.79, 0.62, 0.62, 0.6413, 0.089, 0.4603, 0.04, 0.0418, 0.46, 0.5995, 0.532, 0.65, 0.6545, 0.74, 0.74, 0.02, 0.02, 0, 0, 0, 0.45, 0.8975, 0.92, 0.89, 0.86, 0.69, 0.755, 0.775, 0.585, 0.585, 0.55),
Area = c("Markiezaat", "Hamert", "Hamert", "Hamert", "Hamert", "Hamert", "Hamert", "Hamert", "Hamert", "KempenBroek", "KempenBroek", "KempenBroek", "KempenBroek", "KempenBroek", "KempenBroek", "KempenBroek", "KempenBroek", "KempenBroek", "Markiezaat", "Markiezaat", "Markiezaat", "Markiezaat", "Markiezaat", "Meinweg", "Meinweg", "Meinweg", "PlankenWambuis", "PlankenWambuis", "PlankenWambuis", "PlankenWambuis", "PlankenWambuis", "Valkenhorst", "Valkenhorst", "KempenBroek"))


Previously I used a beta distribution on the manually calculated transformed proportions (so no true 0's or 1's), with a weight argument.

myglmm <- glmmTMB(ProportionBirdsScavenging ~ OverheadCover + (1|Area), data = df_prop_birds_eating, beta_family(link = "logit"), weights = pointWeight_scaled)


However, recently I found out that I actually am using discrete count data and I created the need for weights by converting my raw data into proportions. I solved the problem by analysing the data directly, thereby avoiding any need for weights at all.

I tried the following binomial distribution, with cbind(Birds, Mammals) as response variable.

myglmmbino <- glmmTMB(cbind(Birds, Mammals) ~ OverheadCover + (1|Area), data = df_prop_birds_eating, family = binomial)


One of the assumptions of using a binomial family is that the data should be independent. It's basically whether or not the probability of a bird scavenging affects the probability of a mammal scavenging, right? I find this difficult to say. I statistically checked with a Chi Square test. Is this a valid way? Here we have to reject the null hypothesis, so does that mean that they are dependent on each other?

tbl <- cbind(df_prop_birds_eating$Birds, df_prop_birds_eating$Mammals)
chisq.test(tbl, simulate.p.value = TRUE)
# Pearson's Chi-squared test with simulated p-value (based on 2000 replicates)
#
# data:  tbl
# X-squared = 2356.7, df = NA, p-value = 0.0004998


As far as I know, the other assumptions are met -> Each trial of the experiment has two possible outcomes (Bird or Mammal) and the probability of success is the same for each trial.

My true question is whether or not I am allowed to use the binomial family here.

• Really interesting question. I take it every carcass has scavenging animals? And you don't feel the need to model the total number of scavenging animals? – Paul Hewson Mar 2 at 10:08
• I think you need to be a little more cautious about what you mean by independent. You want the observations to be conditionally independent, given your model. So that Chi-squared test on the top level data won't help. You think that the proportion of birds is conditional on the overhead cover and the area? What other non-independence do you think you might have missed? – Paul Hewson Mar 2 at 10:10
• Yes, every carcass has scavenging animals. And no, I don't feel the need to model the total number of scavenging animals, I'm only interested in the proportion bird / not bird. You are absolutely right: doing a Chi-squared test on the top level data won't give me what I'm looking for, since it is conditional on OverheadCover and Area. I don't have any other variables in my dataset which I expect the proportion of birds is conditional on. Is there a way of testing for independence which controls for the effect of OverheadCover and Area? – Peter Mar 2 at 13:49