Skip to content

Pearson's Chi-Squared Test

A categorical-count test that compares observed and null-expected frequencies through Pearson's weighted squared residuals.

Version
v1 · 2026-10-17 · History
Domain-specific #
14247
Domain group
Formal Sciences
Origin domain
Experimental Design & Statistics
Subdomain
Categorical Data Analysis → Experimental Design & Statistics
Aliases
Pearson chi-square test, Pearson's chi-square test, Chi-squared test (Pearson statistic)

Core Idea

The Pearson chi-squared test checks a categorical-count null by comparing each observed cell count with the count expected if that null held. It sums squared differences divided by their positive expected counts, then evaluates the total under a chi-square reference appropriate to the design. A small tail probability challenges the null; a large one leaves it unrefuted by this sample and procedure. The name identifies the count statistic and its calibrated use, not every test whose reference happens to be chi-square.[1][2]

How would you explain it like I'm…

Do Counts Match the Guess?

Say you guess a bag has the same number of red, blue, and green candies. You count them and compare to your guess. If the counts are way off from your guess, your guess was probably wrong. If they're close, you can't say your guess was wrong, but that doesn't prove it was right either.

Expected vs. Actual Counts Test

Pearson's chi-squared test checks whether counts in different groups match what an idea predicts. For each group, you see how far the real count is from the expected count, square that difference, and divide by the expected count. Then you add those numbers up. A big total means the counts are far from what the idea predicted, so the idea looks doubtful. A small total doesn't prove the idea is true; it just means this test couldn't rule it out.

Observed vs Expected Counts Test

Pearson's chi-squared test compares observed counts in categories with the counts expected under a stated null hypothesis. For each category, or cell, compute (observed − expected)² / expected, then sum across cells. That statistic is compared with an approximate chi-square distribution whose degrees of freedom depend on the null, the sampling design, and what was estimated from the data. The same formula answers different questions: goodness of fit, where expected counts come from a distribution like a fitted Weibull model, and independence in a two-way table, where expected counts come from the row and column totals. A small p-value is evidence against the null; a large one only means the null wasn't refuted by this sample, not that it's true.

 

Pearson's chi-squared test compares observed category counts with those predicted by a stated null hypothesis. For each cell it squares the observed-minus-expected difference and divides by the expected count, then sums these weighted residuals into a single statistic. That statistic is referred to an approximate chi-square distribution whose degrees of freedom depend on the null, the sampling design, and how many parameters were estimated. The same count relation serves very different questions. In goodness of fit, as when NIST binned 101 aluminum-alloy fatigue lives and tested them against a fitted three-parameter Weibull law, expected counts come from a distributional model. In a test of independence, as in a NIST table of 309 wafer defects cross-classified by shift and defect type, expected counts come from the table's margins. The nulls and degrees-of-freedom calculations differ even though the statistic's form is shared. A small p-value counts against the null under the reference assumptions, while a large one leaves the null unrefuted without establishing it; NIST reports p = 0.15 for the Weibull fit and p = 0.00387 against independence. The test is narrower than the whole family of tests whose statistics happen to be asymptotically chi-square.

Scope of Application

The test applies when a categorical null supplies defensible expected cell counts and a valid reference comparison.

  • Binned distributional fit: NIST checks 101 aluminum-alloy fatigue lives against a fitted three-parameter Weibull law, reporting p = 0.15.[1]
  • Contingency independence: NIST's constructed shift-by-defect wafer table yields statistic 19.18 on six reference degrees of freedom and p = 0.00387.[2]

Clarity

Report what one count represents, the tested null, included cells, how expectations were obtained, the statistic and its reference degrees of freedom. The sampling unit, mutually exclusive bins and parameter-estimation procedure determine which counts and reference apply. For independence, an expected cell count comes from its row total times column total divided by the grand total; a fitted distribution supplies bin probabilities instead.[1][2] These are distinct nulls sharing Pearson's arithmetic. Non-rejection does not prove the model correct, and rejection does not identify a cause or every influential cell.

Manages Complexity

The weighted sum compresses many cell discrepancies into one omnibus test, making a whole-table question tractable. That compression hides the signs and locations of deviations. Examine cell residuals when a table-level result needs explanation; descriptive inspection is different from running new cell-specific significance tests, which need separate calibration. Bin choices and small expected counts can change what the summary detects and weaken its chi-square approximation; regrouping or an appropriate alternative requires design-specific judgment.[1][3]

Abstract Reasoning

Start with a declared categorical null and derive positive expected counts for its cells. Compute the sum of each squared observed-minus-expected difference divided by that cell's expectation; then use the reference derived for that sampling and estimation design. In NIST's wafer example, three shifts and four defect types give six independence degrees of freedom. Its Weibull example instead adjusts the binned-fit reference for parameters estimated from bin counts. The same statistic does not make those calibrations interchangeable.[1][2]

Knowledge Transfer

The relation transfers literally between distributional fit and contingency independence: null, expected counts, Pearson residual sum, reference and bounded conclusion. Goodness-of-Fit Test is the direct genus: model, discrepancy, calibration and bounded adequacy readout. Statistical Test is inherited through it. Comparison is internal to each observed-versus-expected cell term; that operation alone supplies neither categorical null nor p-value. At a new table, re-derive expectations, constraints and reference rather than copying the first setting's p-value or degrees of freedom.[1][2]

Relationships to Other Abstractions

Local relationship map for Pearson's Chi-Squared TestParents appear above the current abstraction, mutual partners to the right, and children below. Node labels state whether each abstraction is prime or domain-specific; colors identify relation types.Pearson'sChi-Squared TestDOMAINPrime abstraction: Comparison — includesComparisonPRIMEDomain-specific abstraction: Goodness-of-Fit Test — is a kind ofGoodness-of-FitTestDOMAIN

Current abstraction Pearson's Chi-Squared Test Domain-specific

Parents (2) — outgoing typed relations

  • Pearson's Chi-Squared Test is a kind of Goodness-of-Fit Test Domain-specific

    Pearson's categorical-count procedure is a goodness-of-fit test with a fixed weighted residual statistic.

  • Pearson's Chi-Squared Test includes Comparison Prime

    Each Pearson residual term internally compares observed and null-expected counts for one cell.

Hierarchy paths (2) — routes to 2 parentless roots

Neighborhood in Abstraction Space

Pearson's Chi-Squared Test sits in a sparse region of the domain-specific corpus (75th percentile for distinctiveness): few abstractions share its structure, so a faithful description tends to retrieve it precisely.

Family — Unclustered & Miscellaneous (3155 abstractions)

Nearest neighbors

Computed from structural-signature embeddings · 2026-11-14

References

[1] NIST/SEMATECH, “Chi-Square Goodness-of-Fit Test,” e-Handbook of Statistical Methods, §1.3.5.15, especially Test Statistic, Critical Region and Application Example. https://www.itl.nist.gov/div898/handbook/eda/section3/eda35f.htm. Full official HTML consulted; the original fatigue-life experiment was not independently inspected. registry ↩a ↩b ↩c ↩d ↩e ↩f

[2] NIST/SEMATECH, “How can we compare the results of classifying according to several categories?,” e-Handbook of Statistical Methods, §7.4.5, especially Industrial example, Expected cell frequencies, Test statistic and Degrees of freedom. https://www.itl.nist.gov/div898/handbook/prc/section4/prc45.htm. Full official HTML consulted; the wafer data are presented as a constructed industrial example. registry ↩a ↩b ↩c ↩d ↩e

[3] NIST Dataplot, “Chi-Square Independence Test,” reference page, especially the Note paragraphs on expected frequencies and sampling designs. https://www.itl.nist.gov/div898/software/dataplot/refman1/auxillar/chistest.htm. Full official HTML consulted; its competing expected-cell guidance and exact-test options are design dependent. registry ↩