Statistics IIUnit 77 min read
Chi-Square Tests & Categorical Data Analysis: Tests, Assumptions & Applications
Unit 7 of Statistics II covers chi-square goodness-of-fit tests, tests of independence, and categorical data analysis, including assumptions, test statistics, and real-world applications like market research and quality control.
Key Concepts & Definitions
1. Categorical Data
- Data classified into categories (nominal/ordinal) rather than numerical values.
- Example: Gender (Male/Female), Opinion (Agree/Disagree), Product Preference (Brand A/B/C).
2. Chi-Square (χ²) Tests
A family of non-parametric tests used to analyze categorical data by comparing observed frequencies with expected frequencies under a null hypothesis.
Types of Chi-Square Tests
1. Chi-Square Goodness-of-Fit Test
Purpose: Tests if a sample matches a population distribution. Formula: where:
- = Observed frequency
- = Expected frequency (calculated under )
Assumptions:
- Categorical data (nominal/ordinal).
- Expected frequency in at least 80% of cells (if violated, combine categories).
- Independent observations.
Example: A die is rolled 60 times. Observed frequencies: 10, 8, 12, 9, 11, 10. Test if fair (: for each face).
Steps:
- Calculate : for each face.
- Compute :
- Degrees of Freedom (df): (where = number of categories).
- Critical Value: From χ² table, .
- Decision: Since , fail to reject (die is fair).
2. Chi-Square Test of Independence
Purpose: Tests if two categorical variables are independent (no association). Formula: Same as goodness-of-fit, but is calculated using row/column totals.
Assumptions:
- Same as goodness-of-fit.
- Variables are cross-classified (contingency table).
Example: Test if gender (Male/Female) and smoking status (Smoker/Non-smoker) are independent in a sample of 200 people.
| Smoker | Non-smoker | Total | |
|---|---|---|---|
| Male | 40 | 60 | 100 |
| Female | 20 | 80 | 100 |
| Total | 60 | 140 | 200 |
Steps:
Calculate :
Compute :
df: (where = rows, = columns).
Critical Value: .
Decision: Since , reject (gender and smoking status are dependent).
Comparison Table: Goodness-of-Fit vs. Test of Independence
| Feature | Goodness-of-Fit | Test of Independence |
|---|---|---|
| Purpose | Tests if data fits a distribution. | Tests association between two variables. |
| Hypothesis | : Observed = Expected. | : Variables are independent. |
| Degrees of Freedom | (categories). | (rows × columns). |
| Example Use Case | Testing fairness of a die. | Testing if education level affects job choice. |
Advantages & Limitations
Advantages:
- Non-parametric: No assumptions about population distribution.
- Versatile: Works for nominal/ordinal data.
- Simple Interpretation: Rejecting suggests a meaningful pattern.
Limitations:
- Sample Size Dependency: Requires (use Fisher’s exact test otherwise).
- No Causality: Only tests association, not cause-effect.
- Sensitive to Small Samples: May lack power with few observations.
Applications in Real World
- Market Research:
- Test if customer preferences differ by age group (e.g., soft drink vs. energy drink).
- Quality Control:
- Check if defects in products vary by production shift.
- Medical Studies:
- Determine if a disease is associated with smoking status.
- Social Sciences:
- Analyze voting patterns by demographic groups.
Worked Example: Past Exam Question (Adapted)
Question: A survey of 200 students classified by gender and preference for online vs. offline classes:
| Online | Offline | Total | |
|---|---|---|---|
| Male | 50 | 50 | 100 |
| Female | 40 | 60 | 100 |
| Total | 90 | 110 | 200 |
Test at 5% significance if gender and class preference are independent.
Solution:
Calculate :
Compute :
df: .
Critical Value: .
Decision: → Fail to reject (no significant association).
Exam Tip
What Examiners Look For:
- Correct Hypothesis Formulation:
- Always state and clearly (e.g., ": Variables are independent").
- Expected Frequency Calculation:
- Show all values (partial credit if missing).
- Chi-Square Formula Application:
- Use the correct formula and compute each term separately.
- Degrees of Freedom:
- Remember:
- Goodness-of-fit:
- Test of independence:
- Remember:
- Decision Rule:
- Compare with critical value or use -value (if provided).
- Interpretation:
- Avoid vague statements like "reject ". Instead:
- ✅ "There is significant evidence to suggest an association between [variables]."
- ❌ "The null hypothesis is wrong."
- Avoid vague statements like "reject ". Instead:
Common Mistakes to Avoid:
- Ignoring Assumptions: If , mention it and suggest combining categories.
- Incorrect df: Double-check for contingency tables.
- Arithmetic Errors: Recompute carefully (examiners deduct for calculation mistakes).
- Misinterpreting Results: A rejected means association exists, not causation.
Quick Revision Checklist:
- Can I define chi-square tests and their types?
- Do I know how to calculate expected frequencies?
- Can I compute and determine df correctly?
- Can I interpret results in context (e.g., "smoking and disease are associated")?
- Do I recognize when to use goodness-of-fit vs. test of independence?
End of Note
Based on the TU BSc CSIT syllabus for Statistics II (STA215), unit 7.
Discussion
Loading…