# How to define sampling unit. t.test vs proportion test

In my particular case I am comparing damaged fruit in several treatment fields vs. several control fields

For simplicity:

Both treatment and control have 10 bushes each. a cluster of fruit is taken from each bush (clusters vary in size). The proportion of damaged fruit for each cluster is noted. (I do have access to the original # of fruit per cluster)

For each bush I have the proportion of damaged fruit.

When I perform a test I would like to compare

H0: "Proportion damaged fruit in" treatment <= Proportion damaged fruit in
control
Ha: "" treatment > "" control


(treatment is a lure which is supposed to attract damage)

I performed a t.test(propotion.damaged ~ treatment) because I am comparing mean(proportion.damaged in treatment) vs mean(proportion damaged in control)

However, it occurs to me that

mean(proportion.damaged) = 1/n*sum(proportion.damaged) = (total damaged fruit)/(all the fruit)


Does this mean I should perform a proportions test?

prop.test((damaged fruit treatment/total fruit treatment) vs. (damaged fruit control/total fruit control)


The difference here would be that my sampling unit in the t.test scenario is a bush. Whereas in the proportions test scenario my sampling unit would be a fruit.

Thank you very much for your help.

I think you have framed the question correctly. How you approach the analysis depends upon if you consider the unit of observation as a cluster or as an individual fruit. That is, if you are considering each fruit a countable unit or not.

Usually in horticulture, measurements like "percent diseased" or "percent control" are treated as an inherent proportion or percentage. That is, there is not necessarily a countable unit underlying the percentage. Imagine a turfgrass plot. You might say it has 50% dollar spot inspection --- and you might have some tools to make this measurement more precise --- but there's not a countable area that you can treat as an observation unit.

Likewise, in your case it might make sense to treat each cluster or each bush as the experimental unit.

My inclination in this case would be to not use each fruit as an experimental unit. To me, that wouldn't match up with how people or pests interact with clusters of fruit.

• If I proceed with Prop.Damaged per bush would it make sense to use a t test? or would there be issues with variance homogeneity as was addressed by a_statistician? In which case I could do logarithmic regression on the proportion of damaged fruit per bush. – NicoFish Oct 31 '18 at 17:06
• I see people here did something similar and used a t.test. However, I opted against arcsine transformation because my data is skewed towards 0 infestation, and according to link arcsine transformation "does not work well if p is close to 0 or 1." – NicoFish Oct 31 '18 at 17:06
• A t-test may work well. It depends on the underlying distribution of the data. Or as you suggest, if there is a transformation that would work. Otherwise you might look at a nonparametric approach (Wilcox-Mann-Whitney) or a generalized linear model approach (Gamma regression). – Sal Mangiafico Oct 31 '18 at 17:32
• Also note that Welch's t-test doesn't require equal variance between groups. – Sal Mangiafico Oct 31 '18 at 22:32

Should use mixed effect logistic regression.

Data format:

         Cluster  damaged  count treatment
1         1      2       1
1         0      98      1
2         1      15      1
2         0      75      1
....


damaged = 1 means damaged and = 0 means not damaged. count = # of fruits. Treatment is code for two treatment (treatment and control).

The model would be $$\log\left (\frac {\Pr(Y_{ij}=1)}{\Pr(Y_{ij}=0)} \right) = \beta_0 +\beta_1 X_{i} + \gamma_i$$

Where $$Y_{ij}$$ = 1 if the j-th fruit in i-th cluster is damaged, = 0 otherwise. $$X_i$$ is the treatment received in i-th cluster. $$\gamma_i \sim N(0,\sigma^2)$$ is rnadom intercept for cluster $$i$$.

In the program, the information in column count should be used. the common statements are: weight, count, freq, ...

• Perhaps I was unclear each cluster is a grouping of several fruits. so for example my data would be as follows cluster = 1 Prop.Damaged = .02 #damaged = 2 #Fruit = 100 – NicoFish Oct 31 '18 at 2:42
• "cluster = 1 Prop.Damaged = .02 #damaged = 2 #Fruit = 100". Do not need "Prop.Damaged = .02". This line will be convert to two lines in my data format: 1 1 2 trt, 1 0 98 trt. Need to know this cluster is treatment or control. The second line 98 means 98 fruits not damaged. – user158565 Oct 31 '18 at 2:49
• hmmm, see what you mean for the data format. However, I do not understnad how this would work as a model in R. I would have glm("?? ", family = 'binomial). Could you point me towards something I could read? Is there a problem with my original approach? – NicoFish Oct 31 '18 at 3:09
• your original approach is not good. t test is special case of linear model. In the linear model, one assumptions is homogeneity, i.e., equal variance. In your situation, variance = p(1-p)/n. So each proportion has its unique variance. For R, basically, you are correct, but need to add random intercept and count information. I am not familiar with R. I can do it in SAS very easily. – user158565 Oct 31 '18 at 3:10
• I used Welch's t.test to account for unequal variance. sorry I edited my question because the R formula I had written would not be correct. A resource would be greatly appreciated. I suspect that I will have to change the format to suit R. Thanks – NicoFish Oct 31 '18 at 3:13