Comprehensive Guide to Chi-Square Tests
Introduction to Chi-Square Tests
Chi-square () tests are statistical methods used to test hypotheses regarding patterns of outcomes.
These tests are based on frequency counts for categorical random variables.
The two primary types of chi-square tests covered in this chapter include:
Goodness of fit test: This test assesses how closely the distribution of a single categorical variable matches a specific expected distribution.
Example Application: Determining if the current transportation model (drive, bike, walk, other) for students matches the model used 5 years ago.
Test of independence: This test determines whether two categorical variables are independent of one another or if a significant association exists between them.
Example Application: Investigating if there is an association between gender and smoking habits.
Properties of the Chi-Square Distribution
Family of Distributions: The chi-square distribution is not a single curve but a family of distributions, with a unique curve for every different degree of freedom ().
Parameter: It has only one parameter, which is the degrees of freedom ().
Shape:
The distribution is skewed to the right.
As the degrees of freedom () increase, the distribution becomes more symmetrical.
Values: The distribution assumes only non-negative values ().
Area: The total area under the chi-square curve is equal to .
The Chi-Square Test Statistic
The test statistic represents the discrepancy between observed and expected frequencies.
It can be computed using either of the following formulas:
Variables Defined:
= Observed frequency
= Expected frequency
= Sample size
General Rejection Rule for Chi-Square Tests
Rejection Region: The area of the rejection region is defined by the level of significance (alpha), denoted as .
Location: The rejection region always lies on the right side (upper tail) of the chi-square curve.
Critical Value: The boundary for the rejection region is the critical value, denoted as .
Decision Rule: If the calculated test statistic () lies in the rejection region, reject the null hypothesis () in favour of the alternative hypothesis ().
In mathematical terms: Reject if .
The Goodness-of-Fit Test
The purpose is to verify if an observed sample distribution fits a theoretical distribution.
Degrees of Freedom: For this test, , where is the number of categories.
Goodness-of-Fit Example 1: Drunk Driving Arrests
Scenario: A sample of people arrested for drunk driving is categorized by age to test if the proportion of arrests is the same for all age groups at a level of significance ().
Hypotheses:
: The proportion of people arrested for drunk driving is the same for all age groups.
: The proportion is not the same for all age groups.
Data and Calculation Table ():
Age | Observed (O) | Expected (E) | |
|---|---|---|---|
16-20 | 25 | 20 | |
21-25 | 32 | 20 | |
26-30 | 19 | 20 | |
31-35 | 16 | 20 | |
36-40 | 8 | 20 | |
Total | 100 | 100 | 116.5 |
Calculation of Expected Frequency: Since there are categories, the expected frequency for each group is .
Test Statistic:
Critical Value Determination:
Decision: Since the test statistic is greater than the critical value , we reject at a level of significance.
Conclusion: There is insufficient evidence to conclude that the proportion of drunk drivers is the same for all age groups.
Goodness-of-Fit Example 2: Bokomo Cereal Sales Patterns
Scenario: Bokomo breakfast cereal sells nationally in three sizes (large, medium, small) in a ratio of . A sample from the Limpopo region shows sales of , , and cases respectively. Test at the level of significance () if the Limpopo region's pattern differs from the national pattern.
Hypotheses:
: The Limpopo region’s pattern of sales is the same as the national sales pattern.
: The Limpopo region’s pattern of sales is not the same as the national sales pattern.
Total Sample Size (): cases.
Ratio Components: parts in total.
Data and Calculation Table:
Size | Observed (O) | Expected (E) | |
|---|---|---|---|
Large | 190 | ||
Medium | 250 | ||
Small | 100 | ||
Total | 540 | 540 | 546.91 |
Test Statistic:
Critical Value Determination:
Decision: Since , we reject at a level of significance.
Conclusion: There is insufficient evidence to conclude that the Limpopo region’s pattern of sales is the same as the national sales pattern.
The Chi-Square Test of Independence
This test uses a contingency table to determine if two categorical variables are related.
Degrees of Freedom: For a contingency table, , where is the number of rows and is the number of columns.
Formula for Expected Frequency: For each cell in the table, the expected frequency is calculated as:
Test of Independence Example: Gender and Television Habits
Scenario: A random sample of adults is classified by gender and time spent watching TV (under vs. over hours). Test at a level of significance if TV time is independent of gender.
Hypotheses:
: Gender and time spent watching TV are independent.
: Gender and time spent watching TV are dependent.
Contingency Table (Observed and Expected):
Time Spent | Male | Female | Total |
|---|---|---|---|
Under 25 hours | 27 () | 19 () | 46 |
Over 25 hours | 15 () | 29 () | 44 |
Total | 42 | 48 | 90 |
Detailed Expected Frequency Calculations:
Cell 1 (Male/Under 25):
Cell 2 (Female/Under 25):
Cell 3 (Male/Over 25):
Cell 4 (Female/Over 25):
Test Statistic Calculation Table:
| Observed (O) | Expected (E) | | | :--- | :--- | :--- | :--- | | 27 | 21.47 | 33.95 | | 19 | 24.53 | 14.72 | | 15 | 20.53 | 10.96 | | 29 | 23.47 | 35.83 | | 90 | 90 | 95.46 |
Calculated Test Statistic:
Critical Value Determination:
Decision: Since the calculated statistic ( or based on the transcript's comparison text) is less than the critical value of , we do not reject at a level of significance.
Conclusion: There is insufficient evidence to conclude that the time spent watching TV is dependent on gender.