The Yates Continuity Correction
The Yates correction subtracts 0.5 from every gap between observed and expected counts in a 2x2 table. It explains most "my answer differs from R" puzzles.
Checked on November 21, 2026. Results computed by our statistics engine, version 1.0.0.
In short
- The formula and the cap R applies
- The same table with and without it
- What current advice says
On this page
What the correction does
Counts are whole numbers, but the chi-square distribution is continuous. In 1934 Frank Yates proposed shrinking each gap |O − E| by 0.5 before squaring, to make the continuous curve match the discrete counts better in 2x2 tables (Yates 1934): χ²Y = Σ (|O − E| − 0.5)² / E.
R caps the adjustment so it never exceeds the gap itself: it subtracts min(0.5, |O − E|), so a cell that already matches its expected count is not pushed the other way (R chisq.test source). The correction is only ever applied to 2x2 tables; SciPy applies it whenever the test has 1 degree of freedom (SciPy chi2_contingency).
One table, both ways
| Column 1 | Column 2 | |
|---|---|---|
| Row 1 | 12 | 5 |
| Row 2 | 7 | 7 |
This is the 2x2 example from R's documentation, entered row by row (R reference output).
| Version | χ² | p-value |
|---|---|---|
| Pearson, uncorrected | 1.3716 | 0.2415 |
| Yates-corrected | 0.6411 | 0.4233 |
| N−1 (Campbell) | 1.3274 | 0.2493 |
| Fisher's exact test | exact | 0.2883 |
The correction roughly halves χ² here and raises p from 0.242 to 0.423. Neither is significant, so the conclusion does not change, but the numbers are very different. R prints the corrected p-value, 0.4233 to four decimals, for chisq.test(matrix(c(12, 5, 7, 7), ncol = 2)), because correct = TRUE is the default.
Reproducing both in R and Python
tab <- matrix(c(12, 5, 7, 7), nrow = 2, byrow = TRUE)
chisq.test(tab) # Yates-corrected (default)
chisq.test(tab, correct = FALSE) # Pearson, uncorrectedfrom scipy.stats import chi2_contingency
tab = [[12, 5], [7, 7]]
print(chi2_contingency(tab).pvalue) # corrected (default)
print(chi2_contingency(tab, correction=False).pvalue) # uncorrectedR's documentation enters this table as matrix(c(12, 5, 7, 7), ncol = 2), which fills by column, so its first row is 12 and 7. That is the transpose of the table above, and χ² is the same either way.
Why many statisticians advise against it
The correction makes the test conservative: its real false-positive rate is usually well below the nominal 5%, so it misses real associations more often than it should. Campbell's 2007 study of 2x2 tables found that the N−1 chi-square, or Fisher's exact test when an expected count is below 1, performed better than the Yates-corrected test (Campbell 2007).
It survives because it is the default in R and SciPy and because textbooks still teach it. That is why this site shows the uncorrected and corrected statistics together, with Fisher's exact test, rather than hiding one of them.
When the cap matters
In the constructed table 3 and 0 over 0 and 3, every expected count is 1.5 and every gap is 1.5, so the full 0.5 is subtracted: χ²Y = 4 × (1.5 − 0.5)² / 1.5 = 2.6667, against an uncorrected 6.00. Only when a gap is smaller than 0.5 does R's cap change the arithmetic.
What to report
- Decide before you look at the data, and name the version: "Pearson chi-square without continuity correction" or "with Yates' correction".
- If any expected count is below 1, report Fisher's exact test instead.
- Use the 2x2 calculator to see all versions together, and the APA guide for the reporting format.
Sources
- Yates F. (1934). Contingency tables involving small numbers and the chi-square test. Supplement to the Journal of the Royal Statistical Society 1(2):217-235 checked November 21, 2026
- R source code, chisq.test (stats package) checked November 21, 2026
- SciPy documentation: scipy.stats.chi2_contingency checked November 21, 2026
- R reference example output, stats-Ex.Rout.save checked November 21, 2026
- Campbell I. (2007). Chi-squared and Fisher-Irwin tests of two-by-two tables with small sample recommendations. Statistics in Medicine 26:3661-3675 checked November 21, 2026