# Chi-Square Test

• Dec 2nd 2009, 07:53 AM
statmajor
Chi-Square Test
Let the result of a random experiment be classified as one of the mutually exclusive and exhaustive ways A1, A2, A3 and also one of the mutually exclusive and exhaustive ways B1, B2, B3, B4. 200 independent trials of the experiment result in the following data:

B1 B2 B3 B4
A1 10 21 15 6
A2 11 27 21 13
A3 6 19 27 24

Test at 0.05 significance level the hypothesis of independence. Null hypothesis $\displaystyle H_0 : P(A_i \cap B_j) = P(A_i)P(B_j)$ against the alternate hypothesis (dependence exists)

Would the test statistic be:

$\displaystyle Q(X) = \Sigma \Sigma \frac{(X_{ij} - \frac{C_j R_i}{n})^2}{\frac{C_j R_i}{n}}$
where Cj = the sum of column j, and Ri = sum of row i

so for $\displaystyle X_{11} = \frac{(10 - \frac{(27)(52)}{200})^2}{\frac{(27)(52)}{200}}$

and so forth?
• Dec 2nd 2009, 11:30 AM
novice
Quote:

Originally Posted by statmajor
Let the result of a random experiment be classified as one of the mutually exclusive and exhaustive ways A1, A2, A3 and also one of the mutually exclusive and exhaustive ways B1, B2, B3, B4. 200 independent trials of the experiment result in the following data:

B1 B2 B3 B4
A1 10 21 15 6
A2 11 27 21 13
A3 6 19 27 24

Test at 0.05 significance level the hypothesis of independence. Null hypothesis $\displaystyle H_0 : P(A_i \cap B_j) = P(A_i)P(B_j)$ against the alternate hypothesis (dependence exists)

Would the test statistic be:

$\displaystyle Q(X) = \Sigma \Sigma \frac{(X_{ij} - \frac{C_j R_i}{n})^2}{\frac{C_j R_i}{n}}$
where Cj = the sum of column j, and Ri = sum of row i

so for $\displaystyle X_{11} = \frac{(10 - \frac{(27)(52)}{200})^2}{\frac{(27)(52)}{200}}$

and so forth?

$\displaystyle \begin{array}{cccccc}\ &B1&B2&B3&B4&total\\ A1&10&21&15&6&52\\ A2&11&27&21&13&72\\ A3&6&17&27&24&76\\ \hline Total&27&67&63&43&200\end{array}$

$\displaystyle \chi^2 = \frac{200}{52}(\frac{10}{27}+\frac{21}{67}+\frac{1 5}{63}+\frac{6}{43})+\frac{200}{72}(\frac{11}{27}+ \frac{27}{67}+\frac{21}{63}+\frac{13}{43})+\frac{2 00}{76}(\frac{6}{27}+\frac{17}{67}+\frac{27}{63}+\ frac{24}{43})$

$\displaystyle \chi^2 = 11.9$

Degree of dependency, $\displaystyle \nu = (h-1)(k-1)=(3-1)(2-1)=2$

$\displaystyle P(\chi^2>11.9)=0.997$

Since the P-value (0.997) is larger than the significance level (0.95), we cannot accept the null hypothesis. Thus, we conclude that there is a relationship between A and B.