Chapter9 Chi-square
9.0.1 Overview
107 cases were gathered wherein a former Hogwarts student was a defendant in a magic court case.
Below is a table outlining the number of students who were convicted or acquitted in their case along with the house they belonged to.
9.0.2 Observed Data
| Gryffindor | Hufflepuff | Ravenclaw | Slytherin | Total | |
|---|---|---|---|---|---|
| Convicted | 6 | 9 | 5 | 23 | 43 |
| Acquitted | 25 | 13 | 21 | 5 | 64 |
| Total | 31 | 22 | 26 | 28 | 107 |
We need to conduct a chi-square test to determine whether a students’ former house has any association with whether they were convicted or acquitted.
To do so, we must first calculate the number of convicted/acquitted students expected in each house if the null hypothesis is assumed true.
9.0.3 Expected Data
| Gryffindor | Hufflepuff | Ravenclaw | Slytherin | |
|---|---|---|---|---|
| Convicted | ||||
| Acquitted |
For each cell, calculate:
\[ E = \frac{(\text{row total}) \times (\text{column total})}{\text{total N}} \]
9.0.4 Residuals
| Gryffindor | Hufflepuff | Ravenclaw | Slytherin | |
|---|---|---|---|---|
| Convicted | ||||
| Acquitted |
Now we need to measure the discrepancy between the observed and expected data for each cell with:
\[ \frac{(O - E)^2}{E} \]
In other words, square the difference between each observed and expected frequency and divide that number by the expected frequency for that cell.
9.0.5 Statistical Test
A \(\chi^2(df = \_\_\_) = \_\_\_\)
Insert the correct degrees of freedom in the parentheses:
\[ df = (r - 1)(c - 1) \]
Set \(\chi^2\) equal to the sum of the residuals.
The “critical value” for this test statistic is approximately 7.825.
Would you end up rejecting the null hypothesis?