🧪 Chi-Square Test (χ² Test)
Last Updated: Jan 2026
The Chi-Square Test (χ² Test) is a non-parametric hypothesis test used to determine whether there is a significant relationship between categorical variables.
It compares observed frequencies with expected frequencies.
🗣 Hinglish Tip: Chi-Square test = actual data vs expected data ka comparison
When to Use Chi-Square Test?
Use Chi-Square Test when:
- Data is categorical
- Values are in frequency/count
- Sample size is sufficiently large
- Observations are independent
❌ Not used for:
- Mean comparison
- Numerical data
Types of Chi-Square Test
- Chi-Square Test of Independence
- Chi-Square Test of Goodness of Fit
👉 In this tutorial, we cover Test of Independence (most common)
Chi-Square Notation (Math Standard)
- Observed frequency →
O - Expected frequency →
E - Chi-square statistic →
χ² - Degrees of freedom →
df - Significance level →
α
Chi-Square Formula
χ² = Σ (O − E)² / E
Example
Problem Statement
A survey was conducted to see whether Gender and Preference for Online Course are independent.
| Gender | Like Course | Dislike Course |
|---|---|---|
| Male | 30 | 10 |
| Female | 20 | 40 |
Test at 5% significance level.
Step 1: State the Hypotheses
H₀: Gender and course preference are independent
H₁: Gender and course preference are dependent
Step 2: Create Observed Frequency Table (O)
| Gender | Like | Dislike | Total |
|---|---|---|---|
| Male | 30 | 10 | 40 |
| Female | 20 | 40 | 60 |
| Total | 50 | 50 | 100 |
Step 3: Calculate Expected Frequencies (E)
Formula:
E = (Row Total × Column Total) / Grand Total
| Cell | Calculation | E |
|---|---|---|
| Male–Like | (40 × 50) / 100 | 20 |
| Male–Dislike | (40 × 50) / 100 | 20 |
| Female–Like | (60 × 50) / 100 | 30 |
| Female–Dislike | (60 × 50) / 100 | 30 |
Step 4: Compute χ² Value
| O | E | (O−E)² / E |
|---|---|---|
| 30 | 20 | 5 |
| 10 | 20 | 5 |
| 20 | 30 | 3.33 |
| 40 | 30 | 3.33 |
χ² = 5 + 5 + 3.33 + 3.33 = 16.66
Step 5: Degrees of Freedom
df = (rows − 1)(columns − 1)
df = (2 − 1)(2 − 1) = 1
Step 6: Critical Value
At:
- α = 0.05
- df = 1
From Chi-Square table:
χ²₀.₀₅,₁ = 3.84
Step 7: Decision
- Calculate χ² Value= 16.66
- Compare with Critical Value= 3.84
Since:
16.66 > 3.84
👉 Reject H₀
Step 8: Conclusion
There is significant evidence to conclude that Gender and course preference are dependent.
🗣 Hinglish Tip: Chi-square zyada aaya → relation exist karta hai