Home / Lean Six Sigma / Basic statistics & tests

Chi-square: association, goodness of fit and cross tables

Find out whether the defect depends on the machine, the shift or the supplier, where the difference lies and whether it is large enough to matter, and test whether counts follow history or chance (Poisson). It is for count data (how many good and bad parts, how many defects of each type), not for measurements: paste the cross table as in Excel or a list with one item per row.

Pre-sizing and estimating tool: results do not replace design, calculations or reports signed by a licensed professional, nor verification against the applicable codes and standards.

CheckRevised 11/03/2026
Test
See what was read

Association: first row = column names, first column = row names. Proportions: category · observed · proportion (or historical count). Poisson: count value · number of units, or one column with the count of each unit.

Options

Your inputs stay only on this browser and are not sent anywhere. Untick to delete them.

—Chi-square test
—

Count table

Chi-square test

Other measures

How to read: Pearson chi-square = sum of (observed − expected)² ÷ expected over all cells: zero if everything matches expectation. DF = degrees of freedom. P-value < α = the association (or departure from expectation) is real. Cramér’s V measures strength: below 0.1 weak, 0.1 to 0.3 moderate, above 0.3 strong.

Observed × expected counts

Bars = observed; black dash = what would be expected with no association (or with the tested proportions).

How to read: each group of bars is a category; the bar height is the actual count and the black dash is the count expected with no association. Bars well above the dash show where there are too many occurrences; bars well below, too few. Bars touching the dash = nothing unusual.

Tap the chart to see the values.

Contribution to chi-square

Largest to smallest. Red = more occurrences than expected; blue = fewer.

How to read: each bar is a table cell and its length shows how much it weighs in the total chi-square. The first bars hold most of the explanation: that is where the association happens. Red = more cases than expected (where to act); blue = fewer cases than expected.

Tap the chart to see the values.

Mosaic: make-up of each row

Width = row total; height = % of each column. Thick outline: adjusted residual beyond ±2 (▲ above, ▼ below expected).

How to read: each mosaic column is a table row (e.g. one press), with width proportional to its total; inside it, the colored bands are the % of each category. With no association, the bands sit at the same height in every column; marked steps (and thick outlines) show where the make-up changes.

Tap the chart to see the values.

Adjusted residual map

Each cell shows how many standard errors the count is above (red) or below (blue) expected; beyond ±2 is significant.

How to read: it is the table colored in: each cell holds the adjusted residual (how many “errors” the count is above or below expected). Light color and a number between −2 and +2 = normal. Strong red (above +2) = a combination that happens too often; strong blue (below −2) = too rarely. Start the investigation with the strongest cells.

Tap the chart to see the values.

Observed proportion with 95% CI × test proportion

Dot and bar = observed proportion and its exact interval (Clopper-Pearson); dash = test proportion. A bar that misses the dash points to a category off expectation.

How to read: one row per category: the dot is the observed %, the bar is the uncertainty range of that % and the dash is the expected % (historical or specified). A bar that crosses the dash = category within expectation; a bar entirely to the right or left = a category that really changed.

Tap the chart to see the values.

Reference distribution: where the chi-square fell

Chi-square curve with no association (H0). The shaded area right of the observed value is the P-value.

How to read: the curve shows the chi-square values that appear by chance alone when there is no association. The vertical line is the value from your data. If it falls in the body of the curve, the result is consistent with chance; if it falls in the right tail, past the critical value, the association is statistically significant.

Tap the chart to see the values.

Next step

Take this page’s results to another calculator with the fields already filled in.

The calculation report gathers this page's inputs, results, equations, assumptions and references, with fields for project, engineer and revision. The full report also includes the charts and interpretations, in color. In the print dialog, choose Save as PDF.

Method, assumptions and references

Equations used

Expected: Eᵢⱼ = (row i total × column j total)/N; χ² = Σ(Oᵢⱼ − Eᵢⱼ)²/Eᵢⱼ; DF = (r − 1)(c − 1)
Likelihood ratio: G² = 2·ΣOᵢⱼ·ln(Oᵢⱼ/Eᵢⱼ); standardized residual (O − E)/√E; adjusted residual (O − E)/√[E(1 − Rᵢ/N)(1 − Cⱼ/N)]
Cramér’s V = √[χ²/(N·(min(r, c) − 1))]; Fisher 2×2: sum of hypergeometric probabilities P(a) ≤ P(observed), with fixed margins
Goodness of fit: Eᵢ = N·pᵢ, DF = k − 1; Poisson: λ = Σi·Oᵢ/N, pᵢ = e^−λ·λⁱ/i!, last category 1 − Σpᵢ, DF = k − 2 (k − 1 with known λ)

Assumptions and limits

  • Each item is counted once and items are independent (random sample or ungrouped production). P-value approximated by the chi-square distribution: reliable with expected counts ≥ 5; not computed with an expected count < 1.
  • Poisson: categories formed from the data, grouping those with expected count below 2 (the first accumulates the low values and the last all the high ones).
  • Odds ratio with Woolf CI (adding 0.5 to the cells when there is a zero) and power for w = 0.3 from the noncentral chi-square are interpretive extras.

Standards and technical documents

  • Agresti, A. Categorical Data Analysis, 3rd ed. Wiley, 2013
  • Montgomery, D. C.; Runger, G. C. Applied Statistics and Probability for Engineers, 7th ed. Wiley, 2018, cap. 9
  • Cohen, J. Statistical Power Analysis for the Behavioral Sciences, 2nd ed. Erlbaum, 1988, cap. 7
  • Fisher, R. A. The Design of Experiments. Oliver & Boyd, 1935
  • NIST/SEMATECH e-Handbook of Statistical Methods, seção 1.3.5.15 (Chi-Square Goodness-of-Fit Test)
  • ISO 3534-1:2006 Statistics — Vocabulary and symbols

U.S. regulations

  • ISO 9001:2015, 9.1.3: analysis and evaluation
  • ISO/TR 10017: guidance on statistical techniques

Frequently asked questions

When should I use the chi-square test for association?

When both variables are categories counted on the same parts: machine and defect type, shift and scrap, supplier and receiving acceptance. The test says whether the distribution of one changes with the other. In the press example, press 2 on the 1st shift had 76 rejected handles against 61 expected: p = 0.019, there is an association.

What do expected count and contribution mean?

The expected count is what the cell would hold with no association: row total × column total ÷ grand total. The contribution, (observed − expected)²/expected, shows how much each cell weighs in the chi-square; the largest tell you where to start investigating.

What are adjusted residuals for?

They show, in standard errors, how far each cell is above or below expectation. Above +2 or below −2 the difference in that cell is significant on its own. It is the most direct way to answer “which machine and which shift?”.

When should I use Fisher’s exact test?

In 2×2 tables with small counts (some expected count below 5), common in receiving inspection with few rejected lots. It computes the exact probability and does not rely on the chi-square approximation. The page shows the two-sided result and both one-sided ones.

What is Cramér’s V?

The size of the association, from 0 to 1, which does not grow with the amount of data. With thousands of parts nearly everything gives p < 0.05; V separates strong associations (above 0.5) from those that change no decision (below 0.1).

How do I test whether defects follow history?

Use “Goodness of fit to proportions”: paste the category, the number observed in the period and the historical proportion (or historical count). The test compares the two distributions and the contribution chart shows which defect type changed.

Why test whether defects follow the Poisson?

c and u charts assume defects occur at random (Poisson). If the variance is much larger than the mean, defects cluster in some parts and the chart raises too many alarms. In the panel example, 28 units with 3 defects against 5 expected reject the Poisson hypothesis (p < 0.001).