🧪 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

  1. Chi-Square Test of Independence
  2. 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.

GenderLike CourseDislike Course
Male3010
Female2040

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)

GenderLikeDislikeTotal
Male301040
Female204060
Total5050100

Step 3: Calculate Expected Frequencies (E)

Formula:

E = (Row Total × Column Total) / Grand Total
CellCalculationE
Male–Like(40 × 50) / 10020
Male–Dislike(40 × 50) / 10020
Female–Like(60 × 50) / 10030
Female–Dislike(60 × 50) / 10030

Step 4: Compute χ² Value

OE(O−E)² / E
30205
10205
20303.33
40303.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