# Test for significant differences in two groups of binomial data

In a study per-field disease incidences were collected by sampling 35 plants in each field and counting proportion of infected ones (# of infected/total sampled). In result, each sampling location corresponds to a value between 0 and 1. I have about 100 locations in total, each sampled in the same way.

I have then a column representing two groups of growers knowledge. There are people who have a knowledge and I have a set of disease incidences in their field and I have a group of people who have no knowledge and I have a set of incidence scores in their fields.

What test do I use to see if there is a significant difference in the mean incidence between the groups?

Data are not normally distributed.

My data looks like in those barplots:

• "counting proportion of infected ones" means count the # of infected plants and calculate the proportion by # of infected divided by 35? – user158565 Nov 20 '18 at 16:41
• Yes, made it more explicit in the question now @user158565 – MIH Nov 20 '18 at 16:45
• Is it reasonable to treat incidence within a location as independent? Would disease in one plant imply disease is more likely in the others? That would have implications for a binomial assumption – Glen_b Nov 21 '18 at 1:43

Mixed effect logistic regression is a good choice.

Let $$Y_i$$ be the number of infected plants in field $$i$$. The model is:

$$Y_i \sim Binomial(35,\pi_i)$$

$$\mathrm{logit}(\pi_i)=\log(\frac {\pi_i}{1-\pi_i})=\beta_0 + \beta_1 X_i +\gamma_i$$ where $$X_i =1$$ if grower on the $$i$$-th field is have a knowledge, = 0 for otherwise. $$\gamma_i$$ is random intercept for field $$i$$ to account for possible over-dispersion. $$\beta_1$$ is log odds ratio between knowledge vs no knowledge. The mean proportion of infected is $$\frac{\exp(\beta_0)}{1 + \exp(\beta_0)}$$ for no knowledge grower, and $$\frac{exp(\beta_0+\beta_1)}{1+\exp(\beta_0+\beta_1)}$$ for knowledge grower.

Data format:

    field    plant   infected     knowledge
-------------------------------------------------
1       1        0            0
....................................
1       35       1            0
2       1        1            1
....................................
100      35       0            0
------------------------------------------------

• Is it really a mixed model or just GLM? How would that be structured in R? m <- glmer(incidence ~ knowledge, data = Data, family = binomial(logit)) ? how do i put fixed effect here?  – MIH Nov 20 '18 at 17:08
• knowledge is fixed effect. knowledge = $X_i$ in my formula. After you fitting the model, the estimated coefficient of knowledge is $\hat\beta_1$. incidence can not be response variable. The response variable is infected or not, 0-1 variable. 35 planes/fields needs 35 lines in data per field. – user158565 Nov 20 '18 at 17:18
• Thanks so much for your time! I think there is a misunderstanding. My data look following: incidence = c(0.19, 0.50, 0.75, 0.34, ....) knowledge = c("yes","no","yes",.... etc) Thus, I am interested in per field incidence, not per plant infection. My column (response variable) is a proportion (between 0 and 1) but I know this proportion has been taken from 35 plants in that field. I want to see if farmers with more knowledge had higher incidence or lower in their fields. Does it make sense? – MIH Nov 20 '18 at 17:29
• But based on "# of infected/total sampled", you know the # of infected, and # of total sampled. So it is feasible to recreate the data frame I added in the answer. c(0.19, 0.50, 0.75, 0.34, ....) is regenerated variable and will not be used as response variable if possible, because it has some bad properties, for example, unequal variance. – user158565 Nov 20 '18 at 17:35
• Structured the model in the following way in R. Had to supply incidence and weights. m <- glmer(incidence ~ knowledge+(1|knowledge), data = DataTest, weights =rep(30,nrow(DataTest)),family = binomial(logit))` – MIH Nov 21 '18 at 10:39