An Example of the Chi-Square Test

247 Views Asked by At

Here is another problem dealing with the Chi-Square Test. I am hoping that somebody can confirm that I did it correctly or tell me where I went wrong.
Thanks,
Bob
Problem:
An urn contains $6$ red marbles and $3$ white ones. Two marbles are selected at random from the urn, their colors are noted and then the marbles are replaced in the urn. This process is performed a total of $120$ times, and the result are given below. (a) Determine the expected frequencies. (b) Determinate at a level of significance of $0.05$ whether the results obtained are consistent with those expected.
There were $6$ times when $0$ red balls and $2$ white balls were drawn.
There were $53$ times when $1$ red ball and $1$ white ball were drawn.
There were $61$ times when $2$ red balls and $0$ white balls were drawn.
Answer: (a)
Let $p_{r2}$ be the probability that we draw two red balls. \begin{eqnarray*} p_{r2} &=& \frac{6}{9} \Big( \frac{5}{8} \Big) = \frac{30}{72} \\ p_{r2} &=& \frac{5}{12} \\ \end{eqnarray*} Hence the expected number of times we draw two red balls is $120(\frac{5}{12})$ or $50$. Let $p_{w2}$ be the probability that we draw two white balls. \begin{eqnarray*} p_{w2} &=& \frac{3}{9} \Big( \frac{2}{8} \Big) = \frac{6}{72} \\ p_{w2} &=& \frac{1}{12} \\ \end{eqnarray*} Hence the expected number of times we draw two white balls is $120(\frac{1}{12})$ or $10$. Let $p_{rw}$ be the probability that we draw one white ball and one red ball in either order. \begin{eqnarray*} p_{rw} &=& \frac{6}{9} \Big( \frac{3}{8} \Big) + \frac{3}{9} \Big( \frac{6}{8} \Big) \\ p_{rw} &=& \frac{18 + 18}{72} = \frac{1}{2} \\ \end{eqnarray*} Hence the expected number of times we draw one white ball and one red ball is $120(\frac{1}{2})$ or $60$.
(b)
I am now going to apply the Chi-Square Test to determine how good of a fit we have. \begin{eqnarray*} \chi^2 &=& \frac{(61-50)^2}{50} + \frac{(53-60)^2}{60} + \frac{(6-10)^2}{10} \\ \chi^2 &=& \frac{121}{50} + \frac{49}{60} + \frac{16}{10} \\ \chi^2 &=& 4.8366667 \\ \end{eqnarray*} From a table we find that with two degrees of freedom at the 0.95 confidence level $\chi^2_{0.95} = 5.99$. Therefore we cannot accept the hypothesis that the above procedure was not used. We also cannot accept the hypothesis that it was.

1

There are 1 best solutions below

2
On BEST ANSWER

For $(a)$, yes, your reasoning is correct.

For $(b)$, you set up your hypotheses the wrong way around. With $\chi^2$ test, we set our null hypothesis to be that our results are consistent with the expected results. Furthermore, in statistics, we never talk about accepting the null hypothesis; only whether we reject or fail to reject it.

Let $$H_0 : p_{r2}=\frac{5}{12}, p_{w2}=\frac{1}{12}, p_{rw}=\frac{1}{2}$$

$$H_a :\text{ at least one of these probabilities does not hold}$$

> observed <- c(61,6,53)
> expected <- c(5/12,1/12,1/2)
> chisq.test(x=observed,p=expected)

    Chi-squared test for given probabilities

data:  observed
X-squared = 4.8367, df = 2, p-value = 0.08907

Since $0.05\lt0.08907$ we fail to reject the null hypothesis. We do not have significant evidence to conclude that the results are inconsistent with the expectations.