Pearson and Spearman correlation (two-sided), version 1.1.1
correlation-pearson-spearman@1.1.1: this version's equations with their symbols, each constant's value, their sources and whether each was read, a worked example where the record holds one, its level and what it was checked against, the number of cases, and what was not checked. This version's record is not rewritten; a correction is added under Changes.
What this page can and cannot show
Level: Checked against a reference. Reference kind: not recorded. This level uses the apps' wider definition on the levels page.
Not fully recorded, and not independently reviewed. Items marked "Not recorded" are missing from this project's records for the version named. Apart from any worked example shown, the cases and their values are not printed, so a reader cannot re-run these checks. No independent scientist has yet reviewed these methods or checks.
Every version of this method · Every method · What the levels mean
Version 1.1.1
Level: Checked against a reference. Reference kind: not recorded. This level uses the apps' wider definition on the levels page. correlation-pearson-spearman@1.1.1
What this page can and cannot show
What was checked
Checked against R 4.4.3 (cor.test, Pearson and Spearman; Bonett–Wright written in R) on the 26 correlation cases of the 0.11.0 fixture: r, ρ, S and t within 1e-10 relative, t-based p within 1e-8 relative, Edgeworth p within 1e-10 relative, exact p within 1e-12 absolute, Fisher and Bonett–Wright bounds within 1e-9 absolute, Spearman's p path and withheld states exact; SciPy 1.13.1 agrees on all 30 of the quantities it computes. Simulated coverage of the Spearman interval at 95 percent (20,000 replicates per cell): 94.2 to 96.8 percent in all 24 untied cells, inside the 0.93 to 0.97 gate; tied cells fell as low as 45.6 percent, so the interval is withheld with ties; at 90 and 99 percent it is not simulated and is withheld (2026-10-13).
Cases: no case set is linked to correlation-pearson-spearman@1.1.1.
Not yet recorded for this version
- Equation: not recorded for correlation-pearson-spearman@1.1.1.
- Constants: not recorded for correlation-pearson-spearman@1.1.1.
- Worked example: not recorded for correlation-pearson-spearman@1.1.1.
- Prediction error: not recorded.
What was not checked
What was not checked: not recorded for correlation-pearson-spearman@1.1.1. Its absence does not mean everything was checked.
Changes
2026-11-18-correlation-pearson-spearman@1.1.1-1
2026-11-18 · correlation-pearson-spearman@1.1.1 · Corrections to our methods
- What was wrong: Pearson's r was formed from sums of squares and a cross-product of the centred values as typed. Where a centred value's square passed the largest double, the sum of squares became infinite while the cross-product stayed finite, so r came out 0: x = [0, 0, 1e200] with y = [0, 1, 2] gave r 0, r² 0, t 0 and p 1, where the correlation is √3/2 (0.866), r² 0.75, t √3 and p 1/3. Values whose squares fell below the smallest double gave no r at all.
- Affected: Pearson's r, r², t, p and interval from relate_correlation and the Assay app's correlation in versions 1.0.0 to 1.1.0, only where a centred value was above about 1e154 or every one was below about 1e-154 in absolute value, or a sum of the values passed the largest double. Spearman's ρ was unaffected. Every input whose sums stayed in range gives the same bits as before: the 77 x-y cases of the relationships oracle fixture and 20,000 random sets at scales from 1e-10 to 1e10 were compared bit for bit.
- What changed: In 1.1.1 each variable is divided by a power of two near its largest absolute value before its mean is formed, and each centred vector again before any product. r is unchanged by a positive scale of either variable, and a power of two scales a double exactly, so only inputs that overflowed or underflowed move. x = [0, 0, 1e200], y = [0, 1, 2] now gives r 0.8660254037844386, r² 0.75, t 1.7320508075688772 and p 0.3333, as R's cor.test, SciPy's pearsonr and 50-digit arithmetic do.
- How it was found: An independent audit of the served tools on 15 November 2026, at extreme finite inputs, against R, SciPy and 50-digit arithmetic.
- Cases added: stored reference values: the audit's case against its recorded R, SciPy and 50-digit values within the audit's recorded tolerances; r at x and y scaled by 1e±160 and 1e±200 within 1e-14 of the unscaled r; r at x scaled by 2^±100 and 2^±600 equal bit for bit; values near the largest double.
Tools that use it
Cite this version
Pearson and Spearman correlation (two-sided). Drybench; correlation-pearson-spearman@1.1.1; https://www.drybench.com/methods/m/correlation-pearson-spearman/1.1.1 (accessed [date]).