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

Pearson's chi-squared test compares category counts with the counts predicted by a stated null hypothesis. For every cell it squares the observed-minus-expected difference and divides by the expected count; it then sums those weighted residuals. The resulting statistic is compared with a suitable approximate chi-square reference for that null, sampling design and estimation procedure. The procedure is narrower than the family of all tests whose statistics happen to have a chi-square limiting distribution.[1][2]

The same count relation answers unlike statistical questions. NIST bins 101 measured aluminum-alloy fatigue lives and tests their fit to a fitted three-parameter Weibull law. In another NIST worked example, 309 wafer defects are cross-classified by production shift and defect type to test independence. The first obtains expected cells from a distributional model; the second obtains them from table margins. Each uses Pearson's weighted count discrepancy, but their nulls and degrees-of-freedom calculations are different.[1][2]

A small p-value can count against the stated null under the reference assumptions. A larger p-value leaves that null unrefuted by this test and sample; it does not establish that the null is true. NIST reports p = 0.15 for its Weibull fit and p = 0.00387 against independence in its constructed wafer table.[1][2]

Structural Signature

Sig role-phrases: categorical count cells → stated null → null-expected counts → Pearson weighted residual sum → design-specific reference → bounded inference.

  • Categorical count cells. Define mutually exclusive bins or cross-classification cells and the sampling unit counted once according to the design. Without counts attached to declared cells, this is not the Pearson count statistic. NIST's lifetime bins and shift-by-defect cells are different carriers for the same role.[1][2]
  • Stated categorical null. A hypothesized distribution or independence relation supplies a testable claim about cell probabilities. Without that claim, an expected frequency has no null-based meaning. The Weibull model and shift–defect independence are not interchangeable nulls.[1][2]
  • Null-expected counts. Translate the relevant model into an expected count (E_i) for each included cell. A fitted distribution supplies bin probabilities; for the independence table, row total times column total divided by the overall count supplies each expectation. The estimation choices used to obtain (E_i) affect the subsequent reference.[1][2]
  • Pearson weighted residual sum. Compute (sum_i (O_i-E_i)^2/E_i), where (O_i) is the observed count. Squaring prevents positive and negative deviations from canceling, and division weights a discrepancy by its null expectation. Replacing this formula with a likelihood-ratio statistic or an empirical-distribution distance changes the named procedure.[1][2]
  • Null-reference calibration. Relate the computed sum to the appropriate approximate chi-square law and degrees of freedom for the specific null, fitted parameters and sampling design. NIST's binned goodness-of-fit formula accounts for parameters estimated from bin counts; its three-by-four independence table uses ((r-1)(c-1)). Sparse expected cells can compromise the asymptotic approximation in contingency tables.[1][2][3]
  • Bounded inferential readout. State whether the statistic is unusual under that calibrated null, and what that does and does not establish. Without calibration, the sum is a discrepancy score; without a stated inferential question, a p-value is detached from its target.[1][2]

These roles are jointly required for a completed test. A count table can exist without a null; a statistic can be computed without a valid p-value; and a chi-square reference can be used for a different test. None alone identifies the whole procedure.

What It Is Not

  • Not every chi-squared test. A Wald, score or likelihood-ratio statistic may have a chi-square reference without being the Pearson observed-versus-expected count sum. A shared reference distribution is not a shared test statistic.
  • Not the whole of goodness-of-fit testing. Goodness-of-fit concerns a model's observable implication, a declared discrepancy and null calibration. Pearson's count sum is one possible discrepancy, and its use for independence shows why the exact formula, rather than the word “fit,” identifies this test.[1][2]
  • Not a proof of the null. NIST's p = 0.15 for the fitted Weibull comparison is a non-rejection for the reported data, not confirmation that every fatigue life follows that law.[1]
  • Not a universal sparse-cell remedy. The independence approximation may fail with small expected frequencies. NIST Dataplot describes alternative rules of thumb, intelligent category pooling and Fisher's exact test as options for appropriate tables. Fisher's test is not a drop-in answer for every sparse goodness-of-fit or large-table design.[3]
  • Not a cell-local diagnosis. A large sum establishes an omnibus departure under its conditions. The statistic itself does not state which cells explain the departure or the direction of each deviation.[3]

Scope of Application

The literal domain is statistical testing of categorical counts. A binned distributional goodness-of-fit test asks whether a proposed probability law accounts for the observed category frequencies. A contingency-table independence test asks whether two classifications can be treated as independent. Both can use Pearson's formula when the expected counts and reference are derived for the actual design.[1][2]

Application is conditional. NIST notes that the binned goodness-of-fit statistic changes with the bins and requires enough data for its approximation. Its formula for degrees of freedom assumes the described estimation of distribution parameters from the bin counts. NIST Dataplot separately warns that a contingency-table chi-square reference can be poor with small expected frequencies and that fixed versus random margins matter to exact distributions. One setting's calibration cannot simply be copied into another.[1][3]

Clarity

Before reporting a result, say what one count represents, which cells are included, what the null predicts, how each expectation was calculated, which parameters or margins were estimated, and which reference degrees of freedom were used. Show the statistic's formula and enough of the observed and expected table to make the comparison reproducible. The wafer example supplies both cell counts and expectations; the fitted Weibull example explains its bins and estimation convention.[1][2]

Keep three statements separate: the size of a weighted discrepancy, its tail probability under the declared null, and the substantive conclusion permitted by the design. The statistic can be large because several cells differ moderately or a smaller number differ sharply. A rejected null does not by itself identify the causal reason for those differences, and a non-rejection does not warrant the statement that the model is correct.

Manages Complexity

Pearson's sum compresses a table of many observed and expected values into one reference-calibrated number. This makes a broad null test tractable without asserting that each cell has the same importance or direction. The compression is useful for an omnibus question such as whether a whole table is consistent with independence.[2]

It also hides structure. The sum is made of nonnegative contributions, so it loses the signs of individual deviations. NIST Dataplot describes standardized residuals that expose cell contributions; inspecting them is descriptive diagnosis. If an analyst then runs separate significance tests or claims individual cell effects, those additional inferences need their own calibration and multiplicity care.[3]

Abstract Reasoning

Begin with a table and a null that predicts an expected frequency (E_i>0) for each tested cell. Form

\[ X_P^2=\sum_i\frac{(O_i-E_i)^2}{E_i}. \]

This is not merely a sum of absolute gaps. A deviation of five observations is proportionally larger when ten were expected than when one thousand were expected. The weighting gives the same residual form to bins in the Weibull assessment and cells in the independence table. The reference law depends on more than that algebra: it also depends on how the expected counts and constraints arose.[1][2]

In NIST's wafer table, independence gives (widehat E_{ij}=R_iC_j/n) and the resulting statistic is reported as (19.18). With three rows and four columns, the example uses ((3-1)(4-1)=6) degrees of freedom. In its binned Weibull example, NIST's critical-region discussion subtracts the parameters estimated from bin counts, plus the total-count constraint, from its number of non-empty bins. Those are two derivations for two null structures, not one formula copied indiscriminately.[2][1]

Knowledge Transfer

The transferable structure is null → expected cell counts → Pearson residual sum → valid reference → bounded conclusion. For lifetimes, the null is a fitted distribution, the cells are time-to-failure bins, and the expected counts come from fitted bin probabilities. For wafer defects, the null is independence, cells pair production shift with defect type, and expectations come from observed margins. A practitioner transfers the relation by re-deriving each role, not by carrying over the first example's degrees of freedom or interpretation.[1][2]

This transfer stays within categorical statistical testing. A similar act of comparing observed and expected values in physics, finance or operations does not become Pearson's chi-squared test unless the relevant counts, statistic and calibrated null are present. Conversely, a different formal test of the same categorical null remains a neighbor rather than an instance of this exact statistic.

Examples

Canonical: fitted Weibull law for aluminum-alloy fatigue lives

NIST describes 101 measured failure lives for aluminum-alloy specimens. It bins them into ten groups with approximately ten expected observations per bin and estimates a three-parameter Weibull distribution from the bin counts. The Pearson count discrepancy is compared with the approximate chi-square reference specified for that estimation setup. The reported p-value is 0.15; for this sample and test, the law is not rejected. The original specimen experiment was not inspected for this entry.[1]

Mapped back:

  • Count cells: ten lifetime bins containing 101 measured lives.
  • Null: the fitted three-parameter Weibull distribution.
  • Expected counts: sample size times the fitted probability in each bin.
  • Statistic: Pearson's sum of weighted observed-minus-expected bin deviations.
  • Calibration: NIST's approximate chi-square reference with its stated bin-count parameter-estimation adjustment.
  • Readout: p = 0.15, a non-rejection for the tested dataset, not proof of a Weibull law.[1]

Applied/practice: wafer defect type and production shift

NIST constructs an industrial example with 309 defects classified by three production shifts and four defect types. Under independence, each expected cell count equals its row total times its column total divided by 309. NIST calculates a Pearson statistic of 19.18 with six reference degrees of freedom and reports p = 0.00387, evidence against the stated independence null for this table. The page presents a worked example; it does not establish that these counts came from a documented factory investigation.[2]

Mapped back:

  • Count cells: twelve shift-by-defect-type cells totaling 309 defects.
  • Null: shift and defect type classifications are independent.
  • Expected counts: row and column marginal totals divided by the grand total as a product.
  • Statistic: the same Pearson weighted count-residual sum, reported as 19.18.
  • Calibration: the example's approximate chi-square law with ((r-1)(c-1)=6) degrees of freedom.
  • Readout: p = 0.00387 and rejection of independence for the constructed data, without a causal explanation of why types vary.[2]

Structural Tensions

T1: Finer categories versus reliable asymptotic calibration. Finer bins may reveal a localized departure that pooled bins hide, yet they divide the available observations and can leave sparse expected cells. Pooling can support a reference approximation at the cost of losing some detail. NIST says the goodness-of-fit statistic depends on binning; its Dataplot reference gives competing expected-cell rules rather than a universal cutoff.[1][3] Diagnostic: Would a defensible regrouping change the conclusion, and where are the expected cells too small for the chosen approximation?

T2: One omnibus answer versus a located explanation. A single statistic tests a table-wide null but discards each deviation's direction. Examining residuals can reveal which cells contribute; it takes additional work and may motivate new, separately calibrated inferences. Merely inspecting them is not itself a multiple-testing procedure.[3] Diagnostic: Which cells dominate the sum, and is a later cell-specific statement descriptive or a new inferential claim?

Structural–Framed Character

The relation is strongly structural within statistics: observed counts, null-expected counts, one fixed weighted-residual formula and reference calibration travel literally between distributional fit and contingency independence. Its interpretation remains conditional on the sampling and estimation choices; a p-value is not a free-standing verdict about truth. Analysts choose the null, sampling design, bins and estimation method, but the test's defining relation is a reproducible formal procedure rather than an institution-bound custom. “Pearson” names a historical origin; a test's presence is decided by its count formula and calibrated use, not by the institution performing it.[1][2]

The entry does not travel as a metaphor for any surprise or mismatch. Recognition requires all the count, null, statistic and reference roles; removing one leaves a related diagnostic or different test. Its character: a domain-specific formal test whose count-discrepancy relation remains stable while categorical nulls and their valid calibration differ.

Structural Core vs. Domain Accent

A broad portable skeleton is observed-versus-expected discrepancy followed by model-relative interpretation. That skeleton helps explain the method, but it does not uniquely identify Pearson's test. The domain-specific accent is decisive: categorical frequencies, the exact ((O-E)^2/E) sum, an appropriate chi-square approximation and null-specific degrees of freedom. Keeping that accent prevents a generic comparison from swallowing the test and prevents this test from claiming every calibrated discrepancy as its own.[1][2]

Goodness-of-Fit Test describes calibrated model discrepancy more broadly, and Statistical Test describes null-based procedures more broadly still. Neither description by itself gives Pearson's fixed weighted count sum; a conceptual relationship to either must preserve that differentia.

This entry is part of Comparison and is a kind of Goodness-of-Fit Test.

Goodness-of-Fit Test is the direct statistical genus: each Pearson count test compares observations with the implications of a specified categorical null model and calibrates that discrepancy. The independence null is a product-of-marginals model, so its contingency case also fits that broader identity. Statistical Test is inherited through Goodness-of-Fit Test. Comparison is a distinct internal operation in every observed-versus-expected cell term; it does not by itself supply a test or p-value.

The live Prime Hypothesis Testing (Null vs. Alternative) is a wider inferential neighbor: a Pearson test declares a null and compares data with its null reference, but the Prime is not defined by this particular count formula. Type I & Type II Errors names possible decision errors under repeated testing, not a component required to calculate one Pearson statistic. These relationships explain scope without replacing the count formula.

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 — is part ofComparisonPRIMEDomain-specific abstraction: Goodness-of-Fit Test — is a kind ofGoodness-of-FitTestDOMAIN

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

Parents (2) — more general patterns this builds on

  • 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 is part of 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 (78th percentile for distinctiveness): few abstractions share its structure, so a faithful description tends to retrieve it precisely.

Family — Unclustered & Miscellaneous (2721 abstractions)

Nearest neighbors

Computed from structural-signature embeddings · 2026-10-17

Not to Be Confused With

Goodness-of-Fit Test describes calibrated model adequacy across several possible discrepancy statistics, while this entry requires Pearson's weighted count sum. Statistical Test is broader still. A likelihood-ratio G-test can address a similar categorical null with a different discrepancy; an unbinned Kolmogorov–Smirnov test uses a different distance; and a statistic with an asymptotic chi-square law does not thereby use Pearson's observed-versus-expected count sum. Inspect the formula, null and reference before assigning the name.[1][2]

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 ↩g ↩h ↩i ↩j ↩k ↩l ↩m ↩n ↩o ↩p ↩q ↩r ↩s ↩t ↩u ↩v ↩w

[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 ↩f ↩g ↩h ↩i ↩j ↩k ↩l ↩m ↩n ↩o ↩p ↩q ↩r ↩s ↩t ↩u

[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 ↩a ↩b ↩c ↩d ↩e ↩f ↩g