Two questions, one statistic

Chi-square works on counts, not measurements. It compares the counts observed in a set of categories against those expected under some hypothesis about them, and summarises the mismatch in one number: χ² = Σ (observed − expected)² / expected, over every category. Dividing by the expected count puts each cell on a comparable scale, so a five-count discrepancy matters a great deal where you expected eight and hardly at all where you expected eight hundred. Goodness of fit handles one categorical variable; independence handles two in a contingency table, asking whether the two variables are associated.

Where the expected counts come from

In goodness-of-fit mode you either tick "all categories equally likely", which divides the total evenly (E = N / k), or supply your own expected counts. One behaviour matters here: if your expected counts do not total the observed value, the tool rescales them proportionally instead of erroring, so check the printed expected column rather than assuming it echoes what you typed.

Independence mode builds each expectation from the margins, E_ij = (row total i × column total j) / N, and reports Cramér's V, √(χ² / (N × min(rows−1, columns−1))). Degrees of freedom are k − 1 for goodness of fit and (rows − 1)(columns − 1) for independence, and p is always the upper tail. The Yates continuity correction is a checkbox applying only to a 2×2 table, subtracting 0.5 from each cell's absolute difference before squaring.

Two worked examples with the loaded numbers

Goodness of fit. Observed 30, 22, 18, 10 across four categories, N = 80. Uniform expectation gives 20 each, so the contributions are 100/20, 4/20, 4/20 and 100/20, giving χ² = 10.4 with df = 3 and p = 0.015 — not consistent with an even split.

Independence. A 2×2 table with rows 18, 7 and 24, 31. Row totals are 25 and 55, column totals 42 and 38, N = 80, so the expected counts are 13.125, 11.875, 28.875 and 26.125. Contributions of about 1.8, 2.0, 0.8 and 0.9 give χ² = 5.545, df = 1, p ≈ 0.019 and V = √(5.545/80) = 0.263. Tick Yates and the differences of 4.875 shrink to 4.375: χ² = 4.466 and p ≈ 0.035, nearly double, though the verdict is unchanged here.

Assumptions, small counts and multiple testing

Quick answers

Which mode do I want?

A predicted split of one variable: goodness of fit. Whether two variables go together: independence.

Why did my expected counts change after I entered them?

Because they did not total to N, and the tool rescales them — the expected column shows the values used.

When should I use the Yates correction?

Only for a 2×2 table. It is more conservative and its use is debated, so report both ways when they differ.

My chi-square is small and p is near 1. Does that prove independence?

No — it means the table is close to what independence predicts, and with small counts real associations look alike.