# Test if proportion was the same across batches

I have to solve the following question:

From each of six batches of seed, a random sample of $$100$$ seeds was selected for sowing. The numbers of seeds that failed to germinate in the six samples of $$100$$ seeds were:

$$12,20,9,17,24,16.$$

Test the hypothesis that the proportion of non-germinating seeds was the same for all batches.

My solution is the following:

We have a total of $$98(=12+20+9+17+24+16)$$ non-germinating seeds from our data, out of a total of $$600$$. So, the expected number of non germinating seeds would be $$\frac{98}{600}\cdot100 = 16.3$$.

Thus, from the Pearson-Chi-squared test we get that:

$$X^2 = \frac{(16.3-12)^2}{12} + \frac{(16.3-20)^2}{20}+\frac{(16.3-9)^2}{9} + \frac{(17-16.3)^2}{17}+ \frac{(24-16.3)^2}{24}+ \frac{(16-16.3)^2}{16} = 12.2795$$

Now, we know that $$X^2\sim\chi^{2}_{6-\dim(\theta)-1}$$. Now, my question is what is our $$\dim(\theta)$$ here. Here $$\theta$$ refers to the variable on which the null hypothesis depends. In this particular case, I assumed it would be just the mean, hence $$\dim(\theta)=1$$. Is my assumption correct?

Under this assumption, the problem would then imply that $$X^2\sim\chi^2_{4}$$. The $$95\%$$ point would thus be $$9.488$$. Since $$12.2795>9.488$$, we have that our point is outside the critical region, hence we reject $$H_0$$.

I would like to know if what I did is correct, or, if wrong, what I would need to change.

• (1) DF = 5. (2) You have only 6 components of chi-sq statistic. (3) Denominators of components should be expected counts, not observed counts. Jul 6, 2020 at 23:48
• You are being a smidge unconventional by sometimes presenting $\frac{(O-E)^2}{E}$, and sometimes $\frac{(E-O)^2}{E}$, although the results are identical, it is confusing to read. Jul 7, 2020 at 4:14
• @BruceET (1) I don't understand why DF=5, is basically $\dim(\theta)=0$ as $\theta$ is fully determined by the observations? (2) I do not understand what you are referring to here, I thought I had only 6 myself. (3) well noted and a silly mistake. Would appreciate your input on (1) and (2) Jul 7, 2020 at 12:10
• Fully formed contingency table, as in my Answer, is $2 \times 6$ accounting for all 600 seeds. Expected counts are obtained from row and column totals. If you have row and column totals and only a properly selected 5 of the 12 entries you can reconstruct the rest of the table. DF $=(r-1)(c-1)=(2-1)(6-1) = 5.$ You need a term $(O-E)^2/E$ for each of 12 cells, sum of these 12 components gives chi-sq statistic. // Look at stat textbook for 'chi-squared contingency table'. Jul 7, 2020 at 15:52
• Maybe see this link or similar one. Jul 7, 2020 at 16:03

Consider using a goodness-of-fit approach. The null hypothesis $$H_{0}$$ is that the data comes from a fully formed model vs $$H_{1}$$ that the data is unrestricted.

For $$H_{0}$$ assume that for each seed the probability of failure to germinate is $$p$$, ie each sample is a draw from a Binomial distribution $$B(100,p)$$. Here we can use the Poisson approximation $$P(\lambda)$$. This means the dimension of the null hypothesis is 1 (as it just depends on $$\lambda$$).

The MLE of $$\lambda = \frac{1}{6}\sum_{i=1}^6 x_{i} = 98/6 = 16.33$$.

$$X^2 = \frac{(12-16.3)^2}{16.3} + \frac{(20-16.3)^2}{16.3}+\frac{(9-16.3)^2}{16.3} + \frac{(17-16.3)^2}{16.3}+ \frac{(24-16.3)^2}{16.3}+ \frac{(16-16.3)^2}{16.3} = 8.9$$

$$X^2\sim\chi^{2}_{6-\dim(\lambda)-1} =\chi^{2}_{4}$$

The $$90\%$$ point is $$7.78$$ and the p-value of $$8.9 = 6.3\%$$

Using prop.test in R:

prop.test(c(12,20,9,17,24,16), rep(100,6))

6-sample test for equality of proportions
without continuity correction

data:  c(12, 20, 9, 17, 24, 16) out of rep(100, 6)
X-squared = 10.635, df = 5, p-value = 0.05912
alternative hypothesis: two.sided
sample estimates:
prop 1 prop 2 prop 3 prop 4 prop 5 prop 6
0.12   0.20   0.09   0.17   0.24   0.16


Using chisq.test in R with a contingency table.

ng = c(12,20,9,17,24,16);  g = 100-ng
TBL = rbind(ng,g)
TBL
[,1] [,2] [,3] [,4] [,5] [,6]
ng   12   20    9   17   24   16
g    88   80   91   83   76   84

chisq.test(TBL)
Pearson's Chi-squared test

data:  TBL
X-squared = 10.635, df = 5, p-value = 0.05912


Notice that the DF for the approximating chi-squared distribution, based on a $$6\times 2$$ contingency table is $$\nu = (2-1)(6-1) = 5.$$

P-value is the area under the density curve of $$\mathsf{Chisq}(\nu=5)$$ to the right of the chi-squared statistic.

1 - pchisq(10.63501, 5)
[1] 0.05911663

curve(dchisq(x,5), 0, 20, col="blue", lwd=2,
ylab="PDF", xlab="Chi-squared", main="")
abline(v=0, col="green2"); abline(h=0, col="green2")
abline(v=10.635, col="red", lwd=2, lty="dotted")


• you're right bruce. i forgot about the proportions.. Jul 7, 2020 at 7:47