CHI-SQUARE Analysis

a simple way to ask, "Is this difference too large to ignore?"


Theory in Plain Words

Chi-square analysis is used when our data is mostly about counts. We are not averaging marks or measuring height here. We are counting how many times something happened: how many boys and girls chose a sport, how many red and blue balls were picked, or how many customers preferred each brand.

The basic idea is simple. We compare two things: what we actually saw and what we expected to see. If the two are very close, then the difference may be just normal chance. If the gap is too large, then something important may be going on.

Chi-square does not begin by saying, "There is a difference." It begins cautiously. It first assumes: "There is no real difference, and whatever gap we see may just be chance." This starting assumption is called the null hypothesis.

Then chi-square asks: "If there was really no important difference, would a gap this large still be believable?" If the answer is yes, we stay with the null hypothesis. If the answer is no, we reject it.

In very short form, the formula is: Chi-square = sum of (Observed - Expected)^2 / Expected

The formula looks scary, but each part is doing an easy job. Observed means the count we really got. Expected means the count we would expect if nothing unusual was happening. We subtract to see the gap, square it so negatives do not cancel positives, and divide by expected so the gap is judged fairly.

Why divide by expected? Because a gap of 5 matters differently in different situations. A gap of 5 when we expected 6 is big. A gap of 5 when we expected 500 is tiny. Chi-square adjusts for this.

There are two very common uses of chi-square: goodness of fit and test of independence.

1. Goodness of fit
Here we ask whether one set of observed counts matches some expected pattern. Example: Is a die fair? Are all six outcomes appearing roughly equally often? Are candies of four colors coming in equal numbers?

2. Test of independence
Here we ask whether two categorical variables are related. Example: Is sport choice related to class section? Is buying choice related to gender? If the variables are independent, knowing one should not help us predict the other.

Another term that confuses many people is degrees of freedom. In plain language, it means how many counts are free to vary once some totals are already fixed. For goodness of fit, degrees of freedom is usually: number of categories - 1. For a table, it is usually: (rows - 1) x (columns - 1).

After computing the chi-square value, we compare it with a cutoff value from a chi-square table, or we use a p-value. A p-value is not the probability that your idea is true. It is the probability of seeing a result this extreme, or more extreme, if the null hypothesis were true.

In classroom work, the usual decision rule is: if p is small or the chi-square value is bigger than the critical value, the difference is too large to ignore, so we reject the null hypothesis. If not, we say the data does not give strong enough evidence against the null hypothesis.

This point matters: not rejecting the null hypothesis does not prove everything is equal forever. It only means the present data is not strong enough to show a clear difference.

Chi-square is useful, but it also has limits. It is best for frequency data. It does not measure cause and effect. It does not tell us how large or important a real-world effect is. It only helps decide whether the observed gap is unlikely to be due to chance alone.

There are also a few practical rules. Expected counts should not be extremely tiny. As a simple school-level rule, expected frequencies should usually be at least 5 in most cells. Also, the observations should be independent, meaning one person's result should not automatically decide another person's result.

If you remember only one sentence, remember this: Chi-square checks whether the mismatch between what happened and what was expected is small enough to excuse, or large enough to question.

A good way to stay calm with chi-square is to follow the same four-step habit every time: state the question, write observed counts, write expected counts, then compare them carefully. The formula is only the final organizer of that thinking.

Worked Examples

Example 1: The idea without the formula
Suppose a school canteen expects equal sales of vanilla and chocolate milk: 50 each. But the actual sales are 48 vanilla and 52 chocolate. The gap is very small. Chi-square would also come out small, so we would say this difference could easily be due to normal chance.

Example 2: Goodness of fit with a fair die
A die is rolled 60 times. If it is fair, each face should appear 10 times.

Face Observed Expected
1810
2910
31110
41010
51210
61010

Now compute each part:
(8 - 10)^2 / 10 = 4/10 = 0.4
(9 - 10)^2 / 10 = 1/10 = 0.1
(11 - 10)^2 / 10 = 1/10 = 0.1
(10 - 10)^2 / 10 = 0
(12 - 10)^2 / 10 = 4/10 = 0.4
(10 - 10)^2 / 10 = 0

Total chi-square = 0.4 + 0.1 + 0.1 + 0 + 0.4 + 0 = 1.0
Degrees of freedom = 6 - 1 = 5
This is a small chi-square value, so the die does not look suspicious from this sample.

Example 3: Goodness of fit with a stronger mismatch
A bag is said to contain equal numbers of red, blue, green, and yellow beads. In 80 picks, the observed counts are 32, 18, 16, and 14. If all colors are equally likely, expected count for each color is 80/4 = 20.

Color Observed Expected (O - E)^2 / E
Red32207.2
Blue18200.2
Green16200.8
Yellow14201.8

Total chi-square = 7.2 + 0.2 + 0.8 + 1.8 = 10.0
Degrees of freedom = 4 - 1 = 3
This is much larger than the earlier die example. So the claim of equal color counts now looks doubtful.

Example 4: Test of independence
A teacher wants to know whether sport choice is related to section.

Cricket Football Total
Section A302050
Section B104050
Total4060100

If sport choice and section are independent, expected count for each cell is:
(row total x column total) / grand total

Expected counts become:
Section A, Cricket = 50 x 40 / 100 = 20
Section A, Football = 50 x 60 / 100 = 30
Section B, Cricket = 50 x 40 / 100 = 20
Section B, Football = 50 x 60 / 100 = 30

Now chi-square parts are:
(30 - 20)^2 / 20 = 5
(20 - 30)^2 / 30 = 3.33
(10 - 20)^2 / 20 = 5
(40 - 30)^2 / 30 = 3.33

Total chi-square = 5 + 3.33 + 5 + 3.33 = about 16.66
Degrees of freedom = (2 - 1) x (2 - 1) = 1
This is a large mismatch, so section and sport choice do not look independent in this example.

Example 5: A very small chi-square
Suppose observed counts are 21, 19, 20, and 20 when expected counts are 20 each. The differences are tiny. The chi-square value will also be tiny. This is exactly the sort of case where we should not overreact to random variation.

Example 6: How to read the answer in plain English
Bad conclusion: "Chi-square proved my theory."
Better conclusion: "The data showed a difference too large to comfortably explain by chance alone."
Or, if the result is not significant: "The data did not provide strong enough evidence of a real difference."

Example 7: Common mistakes
Mistake 1: Using percentages without actual counts.
Mistake 2: Forgetting that expected totals must still add up properly.
Mistake 3: Claiming cause and effect from a chi-square test of independence.
Mistake 4: Using very tiny expected frequencies and still trusting the result blindly.

Example 8: Fast memory trick
If observed and expected counts are almost the same, chi-square stays small.
If the gaps are repeatedly large, chi-square grows.
So a small chi-square means "close match," and a large chi-square means "poor match."

Mini cheat sheet
Goodness of fit: one variable, many categories, compare with an expected pattern.
Independence: two variables, table of counts, check whether they are related.
Formula idea: mismatch judged fairly.
Final question: Is the mismatch small enough to ignore, or large enough to question?

CHI-SQUARE is not magic.
It is a careful count-based check of whether
what happened is too far from what was expected.