Statistics & probability

Chi-square goodness of fit

Compare observed category counts with expected relative weights.

Chi-square goodness of fit
Esc to restore

Your inputs

Use the example headings. UTF-8 CSV/TSV files stay on this device; maximum 25 MB.

Up to 25 MB per file, 50,000 data rows, 200 columns and 2 million data cells. Fully blank rows and columns are ignored before row, column and cell limits are checked. Individual tools may have smaller result or chart limits.

Results update as you type. Larger files run when you press Update result.

Your result

LOCAL & PRIVATE

Your result will appear here.

Your inputs stay in this browser. Nothing is uploaded or saved.

A clear answer. Here’s how.

Normalises positive expected weights to the observed count total, then sums (observed−expected)²/expected. Degrees of freedom = categories−1−fitted parameters. Requires at least two categories, whole non-negative observed counts and positive total count. Uses the asymptotic chi-square tail, with a warning for expected counts below 5; no automatic category pooling is performed.

See a worked example

Worked example

A fixed demonstration, separate from the values you enter above.

CSV: Category,Observed,Expected weight
Category,Observed,Expected weight
A,20,1
B,30,1
C,50,1
Parameters estimated from these counts
0

Example result

Example result
CategoryObservedExpectedChi-square contribution
A2033.33333333335.33333333333
B3033.33333333330.333333333333
C5033.33333333338.33333333333

df 2; asymptotic p-value 0.000911881965555. Expected counts are all at least 5.