By AI Roadmap

Published: 2026-09-26

URL: https://codingagent.substack.com/p/lesson-14-statistics-or-how-to-not


Three baselines exist now, each with a resolve rate. The obvious next move — rank them, pick the winner, move on — is also the move most likely to waste the rest of this course chasing noise. On a twenty-instance slice, a two-instance difference between two configurations is not a finding. It’s the kind of number that flips sign if you rerun it, and this lesson exists to stop you from building a narrative on top of a coin flip.

An e-commerce team A/B-testing a new checkout button hits the same trap: a 2% lift over a few hundred sessions looks like a win worth shipping, until someone checks whether that gap would survive a second week of traffic. Ship on noise and the “winning” button gets credit for a difference that was never really there.

This is the last lesson before Gate 1 closes, and it’s the one every later comparison in this course depends on: bootstrap confidence intervals, a floor on how many instances you need before a small gap means anything, and a refusal built directly into the tool — no pre-registered hypothesis, no comparison.

The three sentences this tool has to survive

The curriculum states this lesson’s bar in exactly three testable claims, and the gate checks all three against the actual tool, not against a description of what it should do:


n=20, 2-instance difference:
rate_a=50.0% rate_b=60.0% diff=+10.0% CI=[-20.0%, +40.0%]
NOT SIGNIFICANT
n=300, 40-point difference:
rate_a=33.3% rate_b=73.3% diff=+40.0% CI=[+32.7%, +47.0%]
SIGNIFICANT
missing pre-registration:
REJECTED: no pre-registration at .apr/no_prereg.json -- write one with
write_preregistration() before comparing anything

Real output, this lesson’s dataset. Ten out of twenty versus twelve out of twenty — a difference that would tempt anyone into declaring a winner — reports honestly as not significant, because a confidence interval that spans from −20 points to +40 points is a coin flip wearing a percentage sign. A hundred out of three hundred versus two hundred twenty out of three hundred reports significant, because at that scale the same underlying gap survives resampling. And a comparison run without a pre-registered hypothesis doesn’t run at all.

Why the third check is the one people skip

Bootstrap CIs are the part everyone expects from a statistics lesson. Pre-registration is the part that gets cut under deadline pressure, and it’s the part most responsible for fooling people who already know better than to eyeball a two-point gap. The failure mode isn’t computing the wrong number — it’s computing several comparisons, noticing one of them looks favorable, and reporting that one as the comparison, after the fact. That’s not fraud. It’s what optimism does to anyone running enough configurations, and it’s invisible from the inside.

compare() refuses to run without a PreRegistration file already on disk — a name, a hypothesis, and the metric being compared, written before either result set exists. It costs one line of setup and it’s the only thing standing between “I ran the numbers and found X” and “I found the comparison that looked like X and I’m calling that the numbers.”

Where this sits: the gate every comparison in this course from here forward has to pass through. Nothing downstream is allowed to skip it just because the result looks obviously true.

One bootstrap, or a different resampling per comparison?

Reuse Lesson 11’s bootstrap\ci, or write a new one for the two-sample case? A single-sample CI answers “how uncertain is this one rate.” A comparison needs the uncertainty on the difference between two rates, which isn’t the same question and doesn’t follow from the same resampling. bootstrap\diff\_ci resamples each condition independently, computes the difference on every resample, and reads the interval off the resulting distribution of differences — the correct generalization, not a shortcut that happens to produce plausible-looking numbers.

Call it significant when the p-value crosses a threshold, or when the CI excludes zero? These are mathematically related but not identical framings, and this course picks the CI framing on purpose: a confidence interval that excludes zero tells you the size of the effect you can defend, not just that an effect exists. [+32.7%, +47.0%] says something a bare “p < 0.05” doesn’t — that even the least generous plausible reading of this comparison still shows a real, sizeable gap.