Question
Mathematics
How do you run a chi-squared test of independence on a calculator?
Answer
Mathematics
Expert Answer
For a chi-squared test of independence, enter the observed frequencies, the counts you collected, as a matrix, select the calculator's two-way test, and compare its -value with your chosen significance level. Use counts, not percentages, and leave row and column totals out of the matrix.
The example below uses a TI-84 Plus CE. Other models use different menus, but the statistical setup is the same. The Casio and TI-Nspire equivalents are summarised after the TI-84 steps.
Start with the data and hypotheses
Suppose a random sample of 120 students records each person's usual journey to school and preferred revision format. Each student appears in exactly one cell.
| Journey | Video | Written notes | Practice questions | Total |
|---|---|---|---|---|
| Bus | 32 | 18 | 10 | 60 |
| Walk or cycle | 16 | 24 | 20 | 60 |
| Total | 48 | 42 | 30 | 120 |
We want to test whether journey type and preferred revision format are associated. Before calculating, state:
- : journey type and preferred revision format are independent.
- : journey type and preferred revision format are not independent.
Use a significance level of . The observations should be independent, and the categories should be mutually exclusive, so each observation fits in only one cell. The expected counts must also be large enough for the chi-squared approximation to be reliable. In this example all expected counts exceed 5.
Enter the observed matrix
- Press
2nd→x⁻¹to openMATRIX. - Select
EDIT, then[A]. Use an unused matrix or save any existing contents first. - Set its dimensions to 2 rows × 3 columns.
- Enter the six counts, row by row:
32, 18, 10, then16, 24, 20.
The totals help you check the data, but are not additional observations. Including them would change the test.
Run the test
Press STAT, move to TESTS, and choose χ²-Test. Set Observed to [A] and Expected to [B], then choose Calculate. Matrix [B] is where the calculator will store its expected counts, so use a destination you can overwrite.
Choose χ²-Test, not χ²GOF-Test. Independence tests whether the categorical variables are associated; goodness of fit compares observed counts for a single categorical variable with a specified distribution.
For our table, the calculator gives
In a written answer, give these to 3 significant figures: and .
Other calculators
- Casio fx-CG50:
MENU→Statistics→TEST→CHI→2WAY. Enter the counts intoMat Athrough►MAT, leaveExpectedasMat B, thenExecute. - TI-Nspire CX: first store the counts as a matrix, for example
obs:=[[32,18,10][16,24,20]]. Thenmenu→Statistics→Stat Tests→χ² 2-way Test, and enterobsas the observed matrix. The expected counts are stored asstat.ExpMatrix.
Check the expected counts
Open matrix [B] through the matrix menu. It should contain:
| Journey | Video | Written notes | Practice questions |
|---|---|---|---|
| Bus | 24 | 21 | 15 |
| Walk or cycle | 24 | 21 | 15 |
These are the counts predicted under independence. For example, 48 of the 120 students prefer video. If that proportion also applies to the 60 bus students, the expected video count is
Each cell contributes to the test statistic. The bus/video cell contributes . Adding all six contributions gives
The degrees of freedom reflect how many cell counts can vary once the row and column totals are fixed. Here they are
An unexpected matrix or different is a reason to check your dimensions and entries before interpreting the result.
Write the conclusion in context
Since , reject . There is evidence at the 5% significance level of an association between journey type and preferred revision format in the population sampled.
This does not show that travelling by bus causes students to prefer videos. Nor is the -value the probability that is true. It is the probability of obtaining a test statistic at least as large as if were true.
Practise the full process
Put the full process into practice with the animal-activity question in the AI SL Mock Exam, Set 1, Paper 2. Try checking an expected count before running the test, then explain what the result says about the relationship between road distance and animal activity.
Answered by Revision Village IB Expert
Explore More IB Mathematics Resources
Over 80% of IB students globally are experiencing the power of Revision Village