symmetry: the systematic-b fit divides by its degrees of freedom, as its own chi2 does

Each deviation is taken from a mean fitted on its own orbit, so one degree of
freedom per orbit is spent: dof = sum(n-1) = N - G, the divisor chi2_under a few
lines above already uses. Dividing by N understated the reduced chi^2 and so
overstated the b that brings it to 1 - unevenly, because a low-multiplicity
parent loses a larger fraction of its dof than the higher-multiplicity candidate
it is compared against, and the difference landed on the b RATIO the gates read.

Measured three times independently on disjoint corpora: median ratio inflation
+23.7%, +23.7% and +23.8%, with the corrected ratio lower in 42 of 42 promotions,
so the error pushed toward over-calling. Expect no verdict to move: the b veto
has not been observed to fire on any corpus it has been measured over, and
refused_by=b fired zero times in 25 refusals.

The bounds are left at 1.78 / 2.00 / 0.05 rather than rescaled. They were
calibrated in the old convention, but re-measured on the corrected statistic
against independent space groups they still separate: the genuine maximum is
1.640 and the nearest false step 3.208, so both bounds sit inside the only clean
gap the corrected distribution offers. A second derivation from population
medians argues for 1.38 / 1.56 / 0.07 instead; that is a calibration question for
a battery, not a condition of fixing the arithmetic.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFEJG6WBQv8th4UJFNe53N
This commit is contained in:
leonarski_fandClaude Opus 5 committed 2026-09-05 10:11:19 +02:00
1 parent d4fc09277e
commit 431ac4e3d9
1 file changed
+12 -2
@@ -731,6 +731,10 @@ SearchSpaceGroupResult SearchSpaceGroup(
// floor a-dependent, on a quantity that has no a. Leave it alone.
auto merge_systematic_b = [&](const Orbits& orb) -> double {
std::vector<std::array<double, 3>> obs; // I, sigma, deviation-from-orbit-mean
long n_orbits = 0; // orbits contributing, for the degrees of freedom
for (const Acc& g : orb.acc)
if (g.n >= 2)
++n_orbits;
for (size_t i = 0; i < n; ++i) {
if (orb.orbit[i] < 0)
continue;
@@ -739,13 +743,19 @@ SearchSpaceGroupResult SearchSpaceGroup(
continue;
obs.push_back({I[i], Sigma[i], I[i] - g.swI / g.sw});
}
if (obs.size() < 20)
// Each deviation is taken from a mean fitted on its own orbit, so one degree of freedom per
// orbit is spent: dof = sum(n-1) = N - G, the same denominator chi2_under uses above. Dividing
// by N instead understates the reduced chi^2 and so overstates the b that brings it to 1, and
// it does so unevenly - a low-multiplicity parent loses a larger fraction of its dof than the
// higher-multiplicity candidate, which inflates the b RATIO the gates read.
const double dof = static_cast<double>(obs.size()) - static_cast<double>(n_orbits);
if (obs.size() < 20 || dof <= 0.0)
return 0.0;
auto reduced_chi2 = [&](double b) {
double s = 0.0;
for (const auto& o : obs)
s += o[2] * o[2] / (o[1] * o[1] + (b * o[0]) * (b * o[0]));
return s / static_cast<double>(obs.size());
return s / dof;
};
if (reduced_chi2(0.0) <= 1.0)
return 0.0;