Introduction
Chi Square test: statistical method to analyze categorical variables. Purpose: test independence or goodness of fit. Nonparametric: no assumption about population distribution. Based on comparing observed vs expected frequencies. Widely used in social sciences, biology, marketing, and quality control.
"Statistical inference without rigid assumptions, the chi square test provides a flexible tool for categorical data analysis." -- Karl Pearson
History and Development
Karl Pearson's Contribution
Introduced chi square test in 1900. Developed as goodness-of-fit measure. Foundation: Pearson’s chi square statistic.
Early Applications
Genetics, biology, and anthropology. Testing Mendelian ratios, population genetics.
Modern Extensions
Contingency tables analysis, test for independence. Fisher’s exact test as alternative. Adjustments for small samples.
Chi-Square Distribution
Definition
Distribution of sum of squares of k independent standard normal variables. Denoted χ²(k) where k = degrees of freedom.
Properties
Non-negative, right-skewed distribution. Mean = k, variance = 2k. Approaches normal distribution as k increases.
Role in Test
Test statistic follows chi-square distribution under null hypothesis. Critical values used to determine significance.
| Degrees of Freedom (k) | Mean | Variance |
|---|---|---|
| 1 | 1 | 2 |
| 5 | 5 | 10 |
| 10 | 10 | 20 |
Types of Chi Square Tests
Goodness-of-Fit Test
Tests if observed frequencies match expected distribution. Example: dice fairness, genotype ratios.
Test for Independence
Tests association between two categorical variables in contingency table. Example: gender vs voting preference.
Test for Homogeneity
Compares distribution of categorical variable across different populations. Example: disease prevalence across regions.
Formulas and Calculations
Chi Square Statistic Formula
χ² = Σ (Oᵢ - Eᵢ)² / EᵢWhere:Oᵢ = Observed frequency for category iEᵢ = Expected frequency for category iΣ = Summation over all categoriesExpected Frequency Calculation
Goodness-of-fit: Eᵢ = N × pᵢ where pᵢ = theoretical probability
Test for independence: Eᵢ = (Row total × Column total) / Grand total
Degrees of Freedom
Goodness-of-fit: df = number of categories - 1 - number of estimated parameters
Test for independence: df = (rows - 1) × (columns - 1)
| Test Type | Chi Square Formula | Degrees of Freedom |
|---|---|---|
| Goodness-of-Fit | χ² = Σ (Oᵢ - Eᵢ)² / Eᵢ | k - 1 - parameters |
| Test for Independence | χ² = Σ (Oᵢ - Eᵢ)² / Eᵢ | (r - 1)(c - 1) |
Assumptions and Conditions
Data Type
Data must be categorical, nominal or ordinal scale. Frequencies count of occurrences.
Sample Size
Expected frequency in each cell ≥ 5 for validity. Small samples require alternative tests.
Independence
Observations must be independent. No repeated measures or matched pairs.
Random Sampling
Sample should be representative and randomly selected.
Applications in Research
Biological Sciences
Genetic inheritance patterns, species distribution, epidemiology.
Social Sciences
Survey data analysis, voting behavior, demographic studies.
Marketing and Business
Customer preference, product testing, quality control.
Medical Research
Association between risk factors and diseases, clinical trials categorization.
Advantages and Limitations
Advantages
- Nonparametric: no normality assumption
- Simple calculation and interpretation
- Applicable to multiple categories and variables
- Widely supported in software and textbooks
Limitations
- Requires sufficiently large sample size
- Sensitive to small expected frequencies
- Only tests association, not causation
- Not suitable for continuous data without categorization
Step-by-Step Procedure
Step 1: Define Hypotheses
Null hypothesis (H₀): no association or difference. Alternative hypothesis (H₁): association or difference exists.
Step 2: Collect Data
Organize observed frequencies in contingency table or categories.
Step 3: Calculate Expected Frequencies
Use formulas based on marginal totals or theoretical proportions.
Step 4: Compute Chi Square Statistic
Sum squared differences divided by expected frequencies.
Step 5: Determine Degrees of Freedom
Based on test type and table dimensions.
Step 6: Compare to Critical Value
Use chi-square distribution table or software p-value.
Step 7: Conclusion
Reject or fail to reject H₀ based on significance level α (commonly 0.05).
Example Problem
Problem Statement
A survey categorizes 100 individuals by favorite fruit: Apple, Banana, Cherry. Expected distribution: 40%, 35%, 25%. Observed counts: 35, 45, 20. Test goodness-of-fit at α = 0.05.
Step 1: Hypotheses
H₀: Observed distribution matches expected proportions.
H₁: Observed distribution differs from expected.
Step 2: Expected Frequencies
Apple: 100 × 0.40 = 40
Banana: 100 × 0.35 = 35
Cherry: 100 × 0.25 = 25
Step 3: Calculate χ²
χ² = (35-40)²/40 + (45-35)²/35 + (20-25)²/25 = (−5)²/40 + 10²/35 + (−5)²/25 = 25/40 + 100/35 + 25/25 = 0.625 + 2.857 + 1 = 4.482Step 4: Degrees of Freedom
df = k - 1 = 3 - 1 = 2
Step 5: Critical Value and Decision
At α=0.05 and df=2, critical χ² = 5.991.
Since 4.482 < 5.991, fail to reject H₀.
Conclusion
No significant difference between observed and expected fruit preferences.
Interpretation of Results
P-Value
Probability of observing χ² as extreme as calculated under H₀. Smaller p-value = stronger evidence against H₀.
Significance Level
Threshold α (commonly 0.05) to reject H₀. If p < α, reject null hypothesis.
Effect Size
Measures strength of association: Cramér’s V, Phi coefficient.
Practical vs Statistical Significance
Statistical significance does not imply practical importance.
References
- Pearson, K. "On the Criterion that a Given System of Deviations from the Probable in the Case of a Correlated System of Variables is Such that It Can Be Reasonably Supposed to Have Arisen from Random Sampling." Philosophical Magazine, vol. 50, 1900, pp. 157-175.
- Agresti, A. "Categorical Data Analysis." Wiley, 3rd Edition, 2013, pp. 45-89.
- McHugh, M. L. "The Chi-square test of independence." Biochemia Medica, vol. 23, 2013, pp. 143-149.
- Everitt, B. S., and Skrondal, A. "The Cambridge Dictionary of Statistics." Cambridge University Press, 4th Edition, 2010, pp. 92-95.
- Wasserman, L. "All of Statistics: A Concise Course in Statistical Inference." Springer, 2004, pp. 148-154.