🧪 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)(O)
  • Expected frequency → (E)(E)
  • Chi-square statistic → (χ2) (\chi^2)
  • Degrees of freedom → (df)(df)
  • Significance level → (α)(\alpha)

Chi-Square Formula

χ2=∑(O−E)2E\chi^2 = \sum \frac{(O - E)^2}{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

H0:GenderandcoursepreferenceareindependentH1:GenderandcoursepreferencearedependentH_0: Gender and course preference are independent \\[0.5em] H_1: 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=(RowTotalxColumnTotal)/GrandTotalE = (Row Total x Column Total) / Grand Total
CellCalculationE
Male-Like(40 x 50) / 10020
Male-Dislike(40 x 50) / 10020
Female-Like(60 x 50) / 10030
Female-Dislike(60 x 50) / 10030

Step 4: Compute X2X^2 Value

OOEE(O−E)2/E(O-E)^2 / E
30205
10205
20303.33
40303.33
χ2=5+5+3.33+3.33=16.66\chi^2 = 5 + 5 + 3.33 + 3.33 = 16.66

Step 5: Degrees of Freedom

df=(rows−1)(columns−1)df=(2−1)(2−1)=1df = (\text{rows} - 1)(\text{columns} - 1) \\[0.5em] df = (2 - 1)(2 - 1) = 1

Step 6: Critical Value

At:

  • α\alpha = 0.05
  • df = 1

From Chi-Square table:

χ0.05,12=3.84\chi^2_{0.05,1} = 3.84

Step 7: Decision

  • Calculate χ² Value= 16.66
  • Compare with Critical Value= 3.84

Since:

16.66>3.8416.66 > 3.84

👉 Reject H0H_0


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


Liked This Tutorial

Scan QR Code To Leave A Review Or

Click Here To Leave A Review
Scan QR