Repository navigation
3.0.0-alpha.13
Pre-releaseTie-corrected concordance is now checked against SciPy and R, and has a tie-corrected
Friedman figure. A tasting app that lets judges tie needs concordanceAnalysis to agree with
the tools a statistician would reach for. Until now nothing compared it to any of them.
Added
ConcordanceResult.friedmanCorrected: the Friedman statistic corrected for tied ranks,
friedman / (1 − Σ(t³ − t) / (m(n³ − n))). This is the number SciPy's
scipy.stats.friedmanchisquareand R'sfriedman.testreport, and it equalschiSquare
(m(n − 1)·wCorrected). It is additive:friedmankeeps its meaning as the classic,
uncorrected statistic, so existing callers see no change. From
concordanceAnalysisFromRankSums, which never sees the judges' rows, it equalsfriedman.ConcordanceReferenceTests: seven recorded cases (a no-ties control, a tied pair, a
three-way tie, one judge tying everything, ties in every judge, strong agreement with ties,
and an 11 × 10 integer-score panel the size of the Judgment of Paris). Each pinswCorrected,
chiSquare,friedmanCorrectedandpValueto SciPy 1.18.1, R 4.6.2friedman.testand
irr0.85kendall(correct = TRUE). Statistics are compared at a relative 1e-12 and p-values
at 1e-9. The existingwCorrected,chiSquareandpValuealready agreed on every case.Scripts/reference-fixtures/generate_concordance.py(callsgenerate_concordance.R) and
concordance_cases.txtregenerate the numbers. The tests need neither Python nor R.- DocC:
ConcordanceResultnow has a table of which figures are tie-corrected and by what
formula, and it states that ties must carry averaged ranks.
Fixed
-
A panel in which every judge ties every item is now undefined, as it is in SciPy and R.
The corrected denominatorm²(n³ − n) − m·Σ(t³ − t)is zero exactly then, so W is 0/0.
wCorrectedused to fall back to the uncorrectedw, which is zero. That gave a χ² of 0 and
p = 1: "no agreement, certainly not significant", about a panel that expressed no preference.
wCorrected,chiSquare,friedmanCorrected,pValueandfStatisticare nownan.
The uncorrectedwstays 0, because its formula is defined there. -
pValueisnanwhenchiSquareisnan, in all three concordance entry points. Anan
statistic failedchi2 > 0and fell through top = 1. -
fStatistic(kendallW: .nan, items:)returnsnan, not+∞. TheW = 1guard
abs(1 − W) > ulpOfOneis false for anan, so an undefined W was reported as infinite F. -
SABR at-the-money implied vol is
nan, not+∞, whenforward^(1 − β)squares to zero.
The domain guard admits any positive forward, but atforward = 1e-200,β = 0the square
underflows. The correction termα²/24 / fBeta²was then infinite. Found by the gate's
fp-safetychecker: the division had no guard of its own, and the suppression comment on
the line above it did not cover it. That comment is gone, replaced by a real guard. -
SimulatedAnnealingno longer converts an uncheckedDoubletoInt.
Int(scaledGaussian * 1_000_000)traps on a NaN, an infinity or anything pastInt.max, and
nothing boundsperturbationScale. It is nowInt(exactly:)of the same truncated value,
which is identical for every representable input. An unrepresentable perturbation leaves that
coordinate where it was. Flagged as an error by thefallbackchecker in the gate binary of
2026-11-10.
Tests
ComparableInversionTests.derivedOperatorsInvertOnANaNwas failing onmainunder Apple
Swift 6.4.2. That toolchain's Foundation answersfalsefor bothnanDate >= realDateand
nanDate <= realDate, where earlier toolchains (and CI's 6.2.1) answeredtruethrough the
synthesised!(<). The test was written to be the place a toolchain change shows up, and it
did. It now pins that the two derived operators agree with each other rather than pinning one
toolchain's answer. The guards it motivated were already written not to depend on either answer.