SOLVETUTORMATH SOLVER

Instrument MI-07-030 · Statistics

Chi-Square Calculator

Does your data match the pattern you expected, or is the mismatch too big to be chance? The chi-square statistic turns four pairs of counts into one number that answers that.

Instrument MI-07-030
Sheet 1 OF 1
Rev A
Verified
Type 07 — Hypothesis Testing SER. 2026-07030

Chi-square goodness-of-fit statistic

1.269841

chi^2 = sum( (O_i - E_i)^2 / E_i )

The working Every figure verified twice
  1. chi2 = (50 − 45)^2 ⁄ 45 + (30 − 35)^2 ⁄ 35 + (15 − 15)^2 ⁄ 15 + (5 − 5)^2 ⁄ 5 = 1.269841
Worksheet log
  1. No entries yet — change an input to log a scenario.

How this instrument works

The chi-square goodness-of-fit statistic compares what you actually observed in each category against what you expected to observe, category by category. For each of the four categories this instrument supports, it takes the difference between observed and expected counts, squares it (so overshoots and undershoots both count as deviation, not cancel out), and divides by the expected count (so a given raw difference matters more in a category where you expected few counts than one where you expected many). Adding those four terms gives chi-square.

A chi-square of 0 means every observed count matched its expected count exactly — a perfect fit. The statistic grows as the mismatch grows, in either direction, for any category. On its own, chi-square doesn't say whether that mismatch is 'a lot' — that judgment comes from comparing it to a critical value from the chi-square distribution at your chosen significance level and degrees of freedom (categories minus 1, for a simple goodness-of-fit test), which this instrument reports the raw statistic for but does not itself evaluate against.

This is the classic goodness-of-fit setup: a die you suspect is loaded, a genetics cross you expect to follow a known ratio, a survey response distribution you're checking against a claimed baseline. In every case you have a theoretical or expected distribution across categories, real observed counts to test it against, and a single statistic — chi-square — that quantifies the gap between the two.

χ2=i=14(OiEi)2Ei\chi^2 = \sum_{i=1}^{4} \frac{(O_i - E_i)^2}{E_i}
O1…O4 — observed count in each of the four categories · E1…E4 — expected count in each of the same four categories (each must be greater than zero) · chi-square — the sum of squared, expected-weighted deviations across all four categories.
  • Enter what you actually counted into Observed 1 through Observed 4 — one count per category.
  • Enter what you expected to count in each of those same categories into Expected 1 through Expected 4 — every expected value must be greater than zero.
  • Read Chi-square goodness-of-fit statistic — the sum of (observed − expected)² / expected across all four categories.
  • Only using two or three categories? Set the unused pair's observed and expected counts equal to each other (e.g. both to a small placeholder like 1) so that category contributes exactly zero to the total.
  • A larger chi-square means a bigger overall mismatch between what you observed and what you expected; compare it against a chi-square critical value for your degrees of freedom to test significance.

Worked example — four categories, observed vs. expected counts

Enter Observed 1 = 50, Expected 1 = 45; Observed 2 = 30, Expected 2 = 35; Observed 3 = 15, Expected 3 = 15; Observed 4 = 5, Expected 4 = 5. Category by category: (50−45)²/45 = 25/45 ≈ 0.555556; (30−35)²/35 = 25/35 ≈ 0.714286; (15−15)²/15 = 0/15 = 0; (5−5)²/5 = 0/5 = 0.

Chi-square goodness-of-fit statistic reads 1.269841, the sum of those four terms (0.555556 + 0.714286 + 0 + 0). Categories 3 and 4 matched their expectations exactly and contributed nothing; nearly all of the total mismatch came from categories 1 and 2, where observed counts drifted from expected by 5 in each direction.

Questions

What does a chi-square value of 0 mean?

It means every observed count matched its expected count exactly, in every category — a perfect fit with zero deviation anywhere. It's the floor of the statistic: chi-square can never be negative, since every term is a squared difference divided by a positive expected value, so 0 represents the best possible agreement between observed and expected data.

How do I know if my chi-square value is 'significant'?

Compare it to a critical value from the chi-square distribution, using degrees of freedom equal to the number of categories minus 1 (3, for this instrument's four categories) and your chosen significance level, commonly 0.05. If your computed chi-square exceeds that critical value, the mismatch between observed and expected counts is larger than would be expected by chance alone at that significance level.

Why square the difference between observed and expected instead of just subtracting?

Squaring does two things: it makes every deviation positive, so an observed count that's too high and one that's too low both add to the total instead of cancelling each other out, and it weights larger mismatches more heavily than small ones. Dividing by the expected count then rescales that squared deviation relative to how large the category's expected count was in the first place.

What if I only have two or three categories, not four?

Set the unused category's observed and expected values equal to each other — for example, both to 1 — so that (O−E)²/E works out to exactly 0 for that category and it contributes nothing to the total. Just remember to use the reduced category count (not 4) when looking up degrees of freedom for a significance test afterward.

Why must every expected value be greater than zero?

Because expected count sits in the denominator of each term, (O−E)²/E — dividing by zero is undefined, so an expected count of exactly 0 would break the formula for that category. In practice, an expected count of 0 also signals that category shouldn't really be part of a goodness-of-fit test in the first place, since nothing was expected to land there.

Is this the same as a chi-square test of independence?

No, though both use the same underlying statistic. This instrument computes a goodness-of-fit chi-square, which compares observed counts in categories against a single expected distribution (a claimed ratio, a theoretical model). A chi-square test of independence instead checks whether two categorical variables in a contingency table are related to each other — a different question, built from a different table of expected values.

References