At School A, 5 students are enrolled in Arts and 5 students are enrolled in Science. At School B, 4 students are enrolled in Arts and 6 students are enrolled in Science. To test the null hypothesis that the distribution of the number of students enrolled in Arts is similar to the number of students enrolled in Science at two different schools, let:
a = # of students at School A enrolled in Arts
b = # of students at School A enrolled in Science
c = # of students at School B enrolled in Arts
b = # of students at School B enrolled in Science
To begin calculating the test statistic, the expected proportions for a, b, c and d are calculated first:
Expected a = $\frac{9\cdot 10}{20}$ = 4.5
Expected b = $\frac{11\cdot 10}{20}$ = 5.5${}$
Expected c = $\frac{9\cdot 10}{20}$ = 4.5
Expected d = $\frac{11\cdot 10}{20}$ = 5.5
Now that both the observed and expected proportions for a, b, c and d have been determined, the chi-square test statistic can be calculated using the formula:
${\mathrm{\chi}}^{2}\=\sum _{i\=1}^{n}\frac{{\left({O}_{i}-{E}_{i}\right)}^{2}}{{E}_{i}}$
${\mathrm{\chi}}^{2}\=\frac{{\left(5-4.5\right)}^{2}}{4.5}\+\frac{{\left(5-5.5\right)}^{2}}{5.5}\+\frac{{\left(4-4.5\right)}^{2}}{4.5}\+\frac{{\left(6-5.5\right)}^{2}}{5.5}$
${\mathrm{\chi}}^{2}\=0.20$
In the following interactive example, try to change the proportion of students in the arts and sciences in order to see the effect on the test statistic.