Using Counterfactual Statistics
Overview
When you fork an experiment into matched branches and compare them, you have bought precision, not independence. The branches are repeated measures of one thing; the thing is the run you forked. Nearly every statistical failure in this domain is a consequence of forgetting that — and the rest are consequences of choosing what to measure after seeing the results.
Counterfactual evaluation is unusually powerful and unusually easy to get wrong. Matching branches against a no-op control can cut required sample size by 6× (common-random-numbers-and-matching); counting those branches as independent samples understates your uncertainty by 2.6× and turns a null into a headline (statistical-units-and-clustering). The two errors live one line of code apart.
This pack covers the statistical discipline that paired counterfactual experiments demand and that general ML evaluation guidance does not: what the unit is, what makes the pairing valid, which data may inform which decision, how much of a "best-of-K" result is selection, and what a result must contain before anyone acts on it.
When to Use
Use this pack when:
- You fork branches from a shared snapshot, seed, or checkpoint and compare them against a control.
- Your evaluation includes a no-intervention / no-op branch and you need to anchor utility against it.
- You are about to write
n = in a results table and the rows outnumber the runs you launched.
- A screening stage picks the best of K candidates and you need to report the winner's effect honestly.
- A judge may decline to act, and you need to grade abstention rather than accuracy.
- Someone asks "is this significant?", "how many seeds do we need?", or "why didn't it replicate?"
- You are designing an evaluation harness and want the statistics to be correct by construction rather than by review.
Do not use this pack when:
- You need general A/B or multivariate experiment design for user-facing products, randomisation-unit and assignment mechanics, observational causal inference (difference-in-differences, instrumental variables, propensity scores, RDD), or variance reduction outside CRN (CUPED, stratification) →
yzmir-experimentation (planned — not yet in the marketplace). This pack owns the paired counterfactual slice: the unit is a trajectory, the control is a matched no-op, and the branches are clones of a shared state.
- You are choosing which baselines a growth or morphogenesis experiment must run (off-switch, static-initial, static-final, fixed-schedule), or comparing checkpoints of different shapes →
yzmir-morphogenetic-rl/evaluation-under-topology-change. That sheet answers which comparisons to run; this pack answers what the independent unit is and how to compute a valid interval over it.
- You need bit-exact reproducibility, cross-machine determinism, floating-point or GPU nondeterminism, or replay divergence localisation →
axiom-determinism-and-replay. This pack presupposes that contract: common random numbers is not achievable in a system that cannot replay.
- You are debugging an RL reward function or algorithm choice →
yzmir-deep-rl.
- You need production monitoring, drift detection, or online evaluation →
yzmir-ml-production.
- You need to construct the dataset or eval set rather than reason about it — curation, coverage/slice design, deduplication tooling, label quality and annotator agreement, synthetic-data provenance, the dataset release contract and its documentation standards →
yzmir-ml-production/dataset-curation-and-quality. This pack owns the inference drawn from a split; that sheet owns how the data was built. grouped-splits-and-leakage.md remains authoritative for the leakage taxonomy itself.
- You need general test strategy or flaky-test triage →
ordis-quality-engineering.
The Running Example
Every sheet uses one worked system. Substitute your own nouns:
A training run is periodically snapshotted. At each snapshot the harness forks matched branches from that exact state: K candidate interventions plus one mandatory no-op branch that changes nothing. Every branch resumes from the same snapshot and consumes the same future minibatches. After H steps each branch reports a metric. A candidate's measured effect is metric(no-op) − metric(candidate), so the no-op scores exactly zero by construction.
The fleet: G = 24 independent runs, D = 3 decision points each, K = 8 candidates each — 576 candidate-vs-no-op differences and 24 independent observations.
The same structure covers matched-seed ablation forests, A/B rollouts forked from a shared checkpoint, prompt/config sweeps evaluated on common inputs, and any "clone the world, change one thing, replay" design.
Start Here
Greenfield, in order. Steps 1–3 are the spike: if the unit, the pairing, and the splits are wrong, nothing downstream can be repaired by analysis.
- statistical-units-and-clustering — what one observation is. Everything else takes its
n from here.
- common-random-numbers-and-matching — what must be identical for the pairing to be worth anything. Worth 6× the fleet.
- grouped-splits-and-leakage — the four data roles and the walls between them, assigned by whole units.
- effect-sizes-and-cost-charged-utility — define the quantity you will act on, with a real zero.
- power-and-sample-size-for-paired-designs — how many units the claim needs. Do this before buying compute.
- preregistration-and-exploratory-vs-confirmatory — freeze the plan; commit it before the first confirmatory unit runs.
- frontier-and-reliability-reporting — know what you will report before you run, so you collect it.
Auditing someone else's work instead? Go straight to anti-pattern-catalogue and work down it in order, or dispatch experiment-statistics-reviewer.
How to Access Reference Sheets
All sheets live in the same directory as this SKILL.md. A link like [paired-comparison-methods.md](paired-comparison-methods.md) means: read that file from this directory.
Routing
| Symptom or question |
Primary sheet |
| "Is this significant?" |
statistical-units-and-clustering then paired-comparison-methods |
| "How many runs / seeds / trajectories do I need?" |
power-and-sample-size-for-paired-designs |
| "n = 576 from 24 runs" |
statistical-units-and-clustering |
| "The confidence interval looks too tight" |
statistical-units-and-clustering |
| "Which test — t, Wilcoxon, bootstrap?" |
paired-comparison-methods |
| "Someone ran a two-sample test on paired data" |
paired-comparison-methods |
| "What must branches share to be matched?" |
common-random-numbers-and-matching |
| "Paired differences are noisier than expected" |
common-random-numbers-and-matching |
| "Held-out metric looks too good" |
grouped-splits-and-leakage |
| "Can I tune the threshold on the test set?" |
grouped-splits-and-leakage + abstention-and-calibration |
| "Our best of 40 configs improved X%" |
selection-bias-and-best-of-k |
| "It didn't replicate" |
selection-bias-and-best-of-k + power-and-sample-size-for-paired-designs |
| "Does the admission gate need its own data?" |
selection-bias-and-best-of-k |
| "How do I grade a judge that can do nothing?" |
abstention-and-calibration |
| "Where do I set the admission threshold?" |
abstention-and-calibration |
| "Is this confidence score a probability?" |
abstention-and-calibration |
| "48 p-values, one is 0.03" |
multiple-comparisons-and-sequential-testing |
| "Can we stop the fleet early?" |
multiple-comparisons-and-sequential-testing |
| "Familywise or FDR?" |
multiple-comparisons-and-sequential-testing |
| "Is this null real or underpowered?" |
power-and-sample-size-for-paired-designs |
| "What can we claim with the fleet we can afford?" |
power-and-sample-size-for-paired-designs |
| "What may we change after seeing data?" |
preregistration-and-exploratory-vs-confirmatory |
| "Exploratory or confirmatory?" |
preregistration-and-exploratory-vs-confirmatory |
| "It's significant — but is it worth it?" |
effect-sizes-and-cost-charged-utility |
| "The leaderboard keeps picking expensive candidates" |
effect-sizes-and-cost-charged-utility |
| "Admission and retention decisions disagree" |
effect-sizes-and-cost-charged-utility |
| "How do I write this up?" |
frontier-and-reliability-reporting |
| "Quality vs cost vs stability — which config?" |
frontier-and-reliability-reporting |
| "Do we have to publish the null?" |
frontier-and-reliability-reporting |
| "How long should branches run before we measure?" |
horizon-choice-and-divergence-noise |
| "Short and long horizons disagree" |
horizon-choice-and-divergence-noise |
| "Audit this analysis / harness / paper" |
anti-pattern-catalogue |
| "Which baselines must a growth experiment run?" |
→ yzmir-morphogenetic-rl/evaluation-under-topology-change |
| "Diff-in-diff / IV / propensity on observational data" |
→ yzmir-experimentation (planned) |
| "Same seed, different results across machines" |
→ axiom-determinism-and-replay |
Reference Sheets
Foundations — get these wrong and no later sheet can save the result:
- statistical-units-and-clustering.md — the independent unit, repeated measures, ICC and design effect, cluster-robust inference, pseudo-replication
- paired-comparison-methods.md — zero-anchored controls, aggregate-then-test, paired t / Wilcoxon / bootstrap, when pairing breaks
- common-random-numbers-and-matching.md — the matching contract, RNG-stream discipline, CRN as 6× variance reduction
Data discipline:
- grouped-splits-and-leakage.md — support / screen / audit / report roles, whole-unit splits, the five-class leakage taxonomy, cross-fitting
- selection-bias-and-best-of-k.md — the winner's curse quantified, independent audit data, what analytic corrections assume
- abstention-and-calibration.md — no-op precision/recall, false-intervention rate, regret as the threshold objective, reliability diagrams and ECE
Inference:
- multiple-comparisons-and-sequential-testing.md — family definition, Holm vs BH, alpha spending for interim looks
- power-and-sample-size-for-paired-designs.md — power from unit-level
sd_d, MDE, pilot-variance uncertainty, Type-M exaggeration
- preregistration-and-exploratory-vs-confirmatory.md — the pre-registration artifact, researcher degrees of freedom, honest amendment
Measurement and reporting:
- effect-sizes-and-cost-charged-utility.md — utility with a real zero, admission vs retention weights, practical vs statistical significance
- frontier-and-reliability-reporting.md — the six-row reliability report, quality–cost–stability frontiers, negatives as output
- horizon-choice-and-divergence-noise.md — signal vs divergence noise, the interior optimum, multi-horizon endpoints without p-hacking
Audit:
- anti-pattern-catalogue.md — twenty-one anti-patterns with symptom, mechanism, severity, detector, and fix
Specialist Commands
/design-counterfactual-experiment — from a research question and constraints, emit a complete pre-registered analysis plan: unit, pairing and matching contract, split roles, endpoints, horizon, N, tests, correction method, and abort/success criteria.
/analyze-paired-trial — given branch outcomes keyed by unit, run the correct clustered/paired analysis and emit the reliability report.
/audit-experiment-statistics — adversarially review an existing analysis, harness, or paper against the anti-pattern catalogue; severity-rated findings, each citing the sheet that fixes it.
Specialist Agents
agent: counterfactual-statistician — forward-design SME. Turns a research question into the unit definition, split plan, and pre-registration. Dispatch when designing.
agent: experiment-statistics-reviewer — critic SME. Hunts pseudo-replication, leakage, selection bias, and calibration-on-test in designs, code, or papers. Refuses to rubber-stamp: zero findings is treated as an audit defect. Dispatch when reviewing.
Skills vs agents: sheets design the experiment; agents audit or produce an artifact. Load a sheet when deciding; dispatch an agent when reviewing someone's work or when you want the pre-registration written.
Common Scenarios
Greenfield counterfactual experiment
- statistical-units-and-clustering — name the unit, add
unit_id everywhere
- common-random-numbers-and-matching — write the matching contract, wire the stream assertion into CI
- grouped-splits-and-leakage — assign whole units to four roles by stable hash
- effect-sizes-and-cost-charged-utility — define utility with a zero-anchored control
- horizon-choice-and-divergence-noise — pilot the
d_z curve, pick the plateau centre
- power-and-sample-size-for-paired-designs — size the fleet at the UCL of
sd_d
- preregistration-and-exploratory-vs-confirmatory — commit the plan, then launch
"Is this result real?"
- statistical-units-and-clustering — recount
n; this alone resolves most cases
- paired-comparison-methods — was the pairing used?
- selection-bias-and-best-of-k — how many candidates were tried?
- multiple-comparisons-and-sequential-testing — how big was the family; was it stopped early?
- power-and-sample-size-for-paired-designs — at this
n, is a significant result exaggerated?
"It didn't replicate"
- power-and-sample-size-for-paired-designs — Type-M: was the original underpowered and therefore inflated?
- selection-bias-and-best-of-k — was the original a selected maximum?
- preregistration-and-exploratory-vs-confirmatory — were the two analyses even the same procedure?
- grouped-splits-and-leakage — did the original leak?
Designing a screener / admission gate
- effect-sizes-and-cost-charged-utility — the utility it thresholds
- abstention-and-calibration — calibrate, then choose the threshold by regret
- grouped-splits-and-leakage — fit on screen units, freeze, never touch report units
- selection-bias-and-best-of-k — give the audit stage its own data
Writing up a fleet result
- frontier-and-reliability-reporting — the six-row report over units
- power-and-sample-size-for-paired-designs — MDE, mandatory if the result is null
- anti-pattern-catalogue — self-audit before publishing
Decision Tree
Designing an experiment?
├─ Yes → units → matching → splits → utility → horizon → power → pre-register
└─ No → continue
Auditing an existing analysis, harness, or paper?
└─ anti-pattern-catalogue, in order: units/pairing → walls → selection/testing
→ design adequacy → utility → reporting. Or dispatch
experiment-statistics-reviewer.
Reported n far exceeds runs launched? → statistical-units-and-clustering
Two-sample test on matched arms? → paired-comparison-methods
sd_d larger than the design predicted? → common-random-numbers-and-matching
Held-out number implausibly good? → grouped-splits-and-leakage
"Best of K" reported without K? → selection-bias-and-best-of-k
Gate can decline, graded on accuracy? → abstention-and-calibration
Many p-values, or a fleet stopped early? → multiple-comparisons-and-sequential-testing
Null with no MDE, or a fleet sized from a pilot? → power-and-sample-size-for-paired-designs
Analysis choices made after seeing results? → preregistration-and-exploratory-vs-confirmatory
Winner is the most expensive candidate? → effect-sizes-and-cost-charged-utility
Single mean standing in for a distribution? → frontier-and-reliability-reporting
Reported horizon differs from the design's? → horizon-choice-and-divergence-noise
Rationalization Resistance
| Rationalization |
Reality |
Counter-guidance |
| "We have 576 data points" |
You have 24, measured 24 times each |
Count distinct units — statistical-units-and-clustering |
| "More branches per run is cheaper than more runs" |
True, and it buys precision within a unit only; effective n saturates at roughly G/ICC |
Branches for precision, runs for inference — same sheet |
"It's paired, so ttest_rel handles it" |
Pairing and clustering are separate corrections; you need both |
Aggregate to one difference per unit first — paired-comparison-methods |
| "The task is just noisy" |
Often the branches are unmatched, not the task noisy |
Check the stream digests — common-random-numbers-and-matching |
| "We only tuned the threshold on the test set once" |
Once is enough; the threshold is a fitted parameter and the number is now in-sample |
grouped-splits-and-leakage |
| "Our best variant improved 3%" |
With K=8 and no true effect, the winner shows 1.43 SE of pure selection |
State K, audit on fresh units — selection-bias-and-best-of-k |
| "I'll bias-correct the winner analytically" |
Corrections are unbiased under the global null and over-correct by more than the original bias when a candidate is genuinely good |
The split is the estimator — same sheet |
| "The screener is 87% accurate" |
Accuracy tracks the base rate; a gate that never acts scores well |
Report regret and both baselines — abstention-and-calibration |
| "We only report the significant one" |
48 tests give a 91.5% chance of at least one false positive |
Declare the family — multiple-comparisons-and-sequential-testing |
| "We stopped once the signal was clear" |
Four looks turns 5% into ~13%; continuous monitoring turns it into 100% |
Pre-register a spending function — same sheet |
| "It wasn't significant, so there's no effect" |
At n=24 the MDE was 0.018; effects below that were invisible |
Report the MDE — power-and-sample-size-for-paired-designs |
| "The pilot showed 0.021, so we sized for that" |
A pilot at 25% power exaggerates by ~1.8×, so the fleet is too small |
Size from the cost model — same sheet |
| "We'll write the analysis plan after we see the data" |
The p-value is a property of the procedure, and the procedure becomes unknowable |
preregistration-and-exploratory-vs-confirmatory |
| "The bigger effect at the long horizon is the real one" |
Divergence noise grows faster than signal; the biggest effect is often at the least powerful horizon |
horizon-choice-and-divergence-noise |
| "Loss improved by 3.8%, that's our winner" |
After costs it nets +0.0029 vs +0.0116 for the "worse" candidate |
Charge the costs — effect-sizes-and-cost-charged-utility |
| "Mean improvement is +1.2%, ship it" |
A third of runs got worse and the worst decile is reliably negative |
Six-row reliability report — frontier-and-reliability-reporting |
| "Negative results aren't worth storing" |
Then the audit is unauditable and the next model trains on survivors |
Negatives are output — same sheet |
Red Flags Checklist
Any one of these means stop and route before believing the number:
Integration with Other Skillpacks
| Need |
Pack |
| General A/B design, causal inference on observational data, non-paired applied stats |
yzmir-experimentation (planned) |
| Which baselines a growth/morphogenesis experiment must run; comparing different-shaped checkpoints |
yzmir-morphogenetic-rl/evaluation-under-topology-change |
| Bit-exact replay, cross-machine determinism, divergence localisation (prerequisite for CRN) |
axiom-determinism-and-replay |
| Telemetry schemas that survive shape change; ablation logging |
yzmir-morphogenetic-rl/growth-telemetry-and-ablation |
| RL algorithm choice, reward design, exploration |
yzmir-deep-rl |
| Production monitoring, drift detection, online eval |
yzmir-ml-production |
| Dataset/eval-set construction — curation, dedup tooling, label quality, synthetic-data provenance, release contract |
yzmir-ml-production/dataset-curation-and-quality |
| Test strategy, flaky tests, coverage |
ordis-quality-engineering |
| Writing the result up for a specific audience |
muna-technical-writer |
Quick Reference
| Need |
Use this |
Count n correctly |
statistical-units-and-clustering |
| Pick and run the test |
paired-comparison-methods |
| Make the pairing worth 6× |
common-random-numbers-and-matching |
| Keep decisions and evaluations apart |
grouped-splits-and-leakage |
| Report a selected winner honestly |
selection-bias-and-best-of-k |
| Grade a judge that can abstain |
abstention-and-calibration |
| Survive many tests and interim looks |
multiple-comparisons-and-sequential-testing |
| Size the fleet / state the MDE |
power-and-sample-size-for-paired-designs |
| Freeze the plan |
preregistration-and-exploratory-vs-confirmatory |
| Decide what to measure |
effect-sizes-and-cost-charged-utility |
| Write it up |
frontier-and-reliability-reporting |
| Choose the evaluation horizon |
horizon-choice-and-divergence-noise |
| Audit someone's analysis |
anti-pattern-catalogue |
| Produce a pre-registration |
command /design-counterfactual-experiment, agent counterfactual-statistician |
| Analyse a finished trial |
command /analyze-paired-trial |
| Review an analysis adversarially |
command /audit-experiment-statistics, agent experiment-statistics-reviewer |
The Bottom Line
Forking branches from a shared state buys you precision, not sample size. The independent unit is the thing you would have to launch again — the trajectory, not the branch — and every interval, every power calculation, and every split is denominated in those. Match the branches so the difference contains only the intervention; anchor against a control that scores exactly zero so "do nothing" can win; keep the data that chose a candidate away from the data that judges it; declare the plan before the data can influence it; and report the distribution over units, including the third of runs that got worse. Skip any of these and the experiment will still produce a number — it just will not be a measurement.
1---2name: using-counterfactual-statistics3description: Use for counterfactual and paired-branch ML experiments - matched-seed comparisons, branch rollouts from a shared snapshot, ablation forests, best-of-K screening. Fires on "is this significant", "how many runs/seeds do I need", paired comparison, counterfactual evaluation, selection bias, winner's curse, best-of-K, abstention calibration, data leakage between splits, pre-registration, Pareto frontier reporting, pseudo-replication. Covers the independent statistical unit (the trajectory, not the branch), cluster-robust inference, paired tests against a zero-anchored no-op control, common random numbers, grouped splits, multiple comparisons and sequential testing, paired power analysis, cost-charged utility, and reliability reporting.4---56# Using Counterfactual Statistics78## Overview910**When you fork an experiment into matched branches and compare them, you have bought precision, not independence. The branches are repeated measures of one thing; the thing is the run you forked. Nearly every statistical failure in this domain is a consequence of forgetting that — and the rest are consequences of choosing what to measure after seeing the results.**1112Counterfactual evaluation is unusually powerful and unusually easy to get wrong. Matching branches against a no-op control can cut required sample size by 6× ([common-random-numbers-and-matching](common-random-numbers-and-matching.md)); counting those branches as independent samples understates your uncertainty by 2.6× and turns a null into a headline ([statistical-units-and-clustering](statistical-units-and-clustering.md)). The two errors live one line of code apart.1314This pack covers the statistical discipline that paired counterfactual experiments demand and that general ML evaluation guidance does not: what the unit is, what makes the pairing valid, which data may inform which decision, how much of a "best-of-K" result is selection, and what a result must contain before anyone acts on it.1516## When to Use1718Use this pack when:1920- You fork branches from a shared snapshot, seed, or checkpoint and compare them against a control.21- Your evaluation includes a **no-intervention / no-op branch** and you need to anchor utility against it.22- You are about to write `n =` in a results table and the rows outnumber the runs you launched.23- A screening stage picks the best of K candidates and you need to report the winner's effect honestly.24- A judge may decline to act, and you need to grade abstention rather than accuracy.25- Someone asks "is this significant?", "how many seeds do we need?", or "why didn't it replicate?"26- You are designing an evaluation harness and want the statistics to be correct by construction rather than by review.2728Do **not** use this pack when:2930- You need general A/B or multivariate experiment design for user-facing products, randomisation-unit and assignment mechanics, observational causal inference (difference-in-differences, instrumental variables, propensity scores, RDD), or variance reduction outside CRN (CUPED, stratification) → `yzmir-experimentation` *(planned — not yet in the marketplace)*. **This pack owns the *paired counterfactual* slice**: the unit is a trajectory, the control is a matched no-op, and the branches are clones of a shared state.31- You are choosing which baselines a growth or morphogenesis experiment must run (off-switch, static-initial, static-final, fixed-schedule), or comparing checkpoints of different shapes → `yzmir-morphogenetic-rl/evaluation-under-topology-change`. That sheet answers *which comparisons to run*; this pack answers *what the independent unit is and how to compute a valid interval over it*.32- You need bit-exact reproducibility, cross-machine determinism, floating-point or GPU nondeterminism, or replay divergence localisation → `axiom-determinism-and-replay`. **This pack presupposes that contract**: common random numbers is not achievable in a system that cannot replay.33- You are debugging an RL reward function or algorithm choice → `yzmir-deep-rl`.34- You need production monitoring, drift detection, or online evaluation → `yzmir-ml-production`.35- You need to *construct* the dataset or eval set rather than reason about it — curation, coverage/slice design, deduplication tooling, label quality and annotator agreement, synthetic-data provenance, the dataset release contract and its documentation standards → `yzmir-ml-production/dataset-curation-and-quality`. **This pack owns the inference drawn from a split; that sheet owns how the data was built.** [grouped-splits-and-leakage.md](grouped-splits-and-leakage.md) remains authoritative for the leakage taxonomy itself.36- You need general test strategy or flaky-test triage → `ordis-quality-engineering`.3738## The Running Example3940Every sheet uses one worked system. Substitute your own nouns:4142> A training run is periodically **snapshotted**. At each snapshot the harness forks **matched branches** from that exact state: `K` candidate interventions plus one mandatory **no-op branch** that changes nothing. Every branch resumes from the same snapshot and consumes the **same future minibatches**. After `H` steps each branch reports a metric. A candidate's measured effect is `metric(no-op) − metric(candidate)`, so the no-op scores exactly zero by construction.43>44> The fleet: **G = 24** independent runs, **D = 3** decision points each, **K = 8** candidates each — 576 candidate-vs-no-op differences and **24 independent observations**.4546The same structure covers matched-seed ablation forests, A/B rollouts forked from a shared checkpoint, prompt/config sweeps evaluated on common inputs, and any "clone the world, change one thing, replay" design.4748## Start Here4950Greenfield, in order. Steps 1–3 are the spike: if the unit, the pairing, and the splits are wrong, nothing downstream can be repaired by analysis.51521. **[statistical-units-and-clustering](statistical-units-and-clustering.md)** — what one observation is. Everything else takes its `n` from here.532. **[common-random-numbers-and-matching](common-random-numbers-and-matching.md)** — what must be identical for the pairing to be worth anything. Worth 6× the fleet.543. **[grouped-splits-and-leakage](grouped-splits-and-leakage.md)** — the four data roles and the walls between them, assigned by whole units.554. **[effect-sizes-and-cost-charged-utility](effect-sizes-and-cost-charged-utility.md)** — define the quantity you will act on, with a real zero.565. **[power-and-sample-size-for-paired-designs](power-and-sample-size-for-paired-designs.md)** — how many units the claim needs. Do this *before* buying compute.576. **[preregistration-and-exploratory-vs-confirmatory](preregistration-and-exploratory-vs-confirmatory.md)** — freeze the plan; commit it before the first confirmatory unit runs.587. **[frontier-and-reliability-reporting](frontier-and-reliability-reporting.md)** — know what you will report before you run, so you collect it.5960Auditing someone else's work instead? Go straight to **[anti-pattern-catalogue](anti-pattern-catalogue.md)** and work down it in order, or dispatch `experiment-statistics-reviewer`.6162## How to Access Reference Sheets6364All sheets live in the same directory as this `SKILL.md`. A link like `[paired-comparison-methods.md](paired-comparison-methods.md)` means: read that file from this directory.6566## Routing6768| Symptom or question | Primary sheet |69|---|---|70| "Is this significant?" | [statistical-units-and-clustering](statistical-units-and-clustering.md) then [paired-comparison-methods](paired-comparison-methods.md) |71| "How many runs / seeds / trajectories do I need?" | [power-and-sample-size-for-paired-designs](power-and-sample-size-for-paired-designs.md) |72| "n = 576 from 24 runs" | [statistical-units-and-clustering](statistical-units-and-clustering.md) |73| "The confidence interval looks too tight" | [statistical-units-and-clustering](statistical-units-and-clustering.md) |74| "Which test — t, Wilcoxon, bootstrap?" | [paired-comparison-methods](paired-comparison-methods.md) |75| "Someone ran a two-sample test on paired data" | [paired-comparison-methods](paired-comparison-methods.md) |76| "What must branches share to be matched?" | [common-random-numbers-and-matching](common-random-numbers-and-matching.md) |77| "Paired differences are noisier than expected" | [common-random-numbers-and-matching](common-random-numbers-and-matching.md) |78| "Held-out metric looks too good" | [grouped-splits-and-leakage](grouped-splits-and-leakage.md) |79| "Can I tune the threshold on the test set?" | [grouped-splits-and-leakage](grouped-splits-and-leakage.md) + [abstention-and-calibration](abstention-and-calibration.md) |80| "Our best of 40 configs improved X%" | [selection-bias-and-best-of-k](selection-bias-and-best-of-k.md) |81| "It didn't replicate" | [selection-bias-and-best-of-k](selection-bias-and-best-of-k.md) + [power-and-sample-size-for-paired-designs](power-and-sample-size-for-paired-designs.md) |82| "Does the admission gate need its own data?" | [selection-bias-and-best-of-k](selection-bias-and-best-of-k.md) |83| "How do I grade a judge that can do nothing?" | [abstention-and-calibration](abstention-and-calibration.md) |84| "Where do I set the admission threshold?" | [abstention-and-calibration](abstention-and-calibration.md) |85| "Is this confidence score a probability?" | [abstention-and-calibration](abstention-and-calibration.md) |86| "48 p-values, one is 0.03" | [multiple-comparisons-and-sequential-testing](multiple-comparisons-and-sequential-testing.md) |87| "Can we stop the fleet early?" | [multiple-comparisons-and-sequential-testing](multiple-comparisons-and-sequential-testing.md) |88| "Familywise or FDR?" | [multiple-comparisons-and-sequential-testing](multiple-comparisons-and-sequential-testing.md) |89| "Is this null real or underpowered?" | [power-and-sample-size-for-paired-designs](power-and-sample-size-for-paired-designs.md) |90| "What can we claim with the fleet we can afford?" | [power-and-sample-size-for-paired-designs](power-and-sample-size-for-paired-designs.md) |91| "What may we change after seeing data?" | [preregistration-and-exploratory-vs-confirmatory](preregistration-and-exploratory-vs-confirmatory.md) |92| "Exploratory or confirmatory?" | [preregistration-and-exploratory-vs-confirmatory](preregistration-and-exploratory-vs-confirmatory.md) |93| "It's significant — but is it worth it?" | [effect-sizes-and-cost-charged-utility](effect-sizes-and-cost-charged-utility.md) |94| "The leaderboard keeps picking expensive candidates" | [effect-sizes-and-cost-charged-utility](effect-sizes-and-cost-charged-utility.md) |95| "Admission and retention decisions disagree" | [effect-sizes-and-cost-charged-utility](effect-sizes-and-cost-charged-utility.md) |96| "How do I write this up?" | [frontier-and-reliability-reporting](frontier-and-reliability-reporting.md) |97| "Quality vs cost vs stability — which config?" | [frontier-and-reliability-reporting](frontier-and-reliability-reporting.md) |98| "Do we have to publish the null?" | [frontier-and-reliability-reporting](frontier-and-reliability-reporting.md) |99| "How long should branches run before we measure?" | [horizon-choice-and-divergence-noise](horizon-choice-and-divergence-noise.md) |100| "Short and long horizons disagree" | [horizon-choice-and-divergence-noise](horizon-choice-and-divergence-noise.md) |101| "Audit this analysis / harness / paper" | [anti-pattern-catalogue](anti-pattern-catalogue.md) |102| "Which baselines must a growth experiment run?" | → `yzmir-morphogenetic-rl/evaluation-under-topology-change` |103| "Diff-in-diff / IV / propensity on observational data" | → `yzmir-experimentation` *(planned)* |104| "Same seed, different results across machines" | → `axiom-determinism-and-replay` |105106## Reference Sheets107108**Foundations** — get these wrong and no later sheet can save the result:1091101. [statistical-units-and-clustering.md](statistical-units-and-clustering.md) — the independent unit, repeated measures, ICC and design effect, cluster-robust inference, pseudo-replication1112. [paired-comparison-methods.md](paired-comparison-methods.md) — zero-anchored controls, aggregate-then-test, paired t / Wilcoxon / bootstrap, when pairing breaks1123. [common-random-numbers-and-matching.md](common-random-numbers-and-matching.md) — the matching contract, RNG-stream discipline, CRN as 6× variance reduction113114**Data discipline:**1151164. [grouped-splits-and-leakage.md](grouped-splits-and-leakage.md) — support / screen / audit / report roles, whole-unit splits, the five-class leakage taxonomy, cross-fitting1175. [selection-bias-and-best-of-k.md](selection-bias-and-best-of-k.md) — the winner's curse quantified, independent audit data, what analytic corrections assume1186. [abstention-and-calibration.md](abstention-and-calibration.md) — no-op precision/recall, false-intervention rate, regret as the threshold objective, reliability diagrams and ECE119120**Inference:**1211227. [multiple-comparisons-and-sequential-testing.md](multiple-comparisons-and-sequential-testing.md) — family definition, Holm vs BH, alpha spending for interim looks1238. [power-and-sample-size-for-paired-designs.md](power-and-sample-size-for-paired-designs.md) — power from unit-level `sd_d`, MDE, pilot-variance uncertainty, Type-M exaggeration1249. [preregistration-and-exploratory-vs-confirmatory.md](preregistration-and-exploratory-vs-confirmatory.md) — the pre-registration artifact, researcher degrees of freedom, honest amendment125126**Measurement and reporting:**12712810. [effect-sizes-and-cost-charged-utility.md](effect-sizes-and-cost-charged-utility.md) — utility with a real zero, admission vs retention weights, practical vs statistical significance12911. [frontier-and-reliability-reporting.md](frontier-and-reliability-reporting.md) — the six-row reliability report, quality–cost–stability frontiers, negatives as output13012. [horizon-choice-and-divergence-noise.md](horizon-choice-and-divergence-noise.md) — signal vs divergence noise, the interior optimum, multi-horizon endpoints without p-hacking131132**Audit:**13313413. [anti-pattern-catalogue.md](anti-pattern-catalogue.md) — twenty-one anti-patterns with symptom, mechanism, severity, detector, and fix135136## Specialist Commands137138- **`/design-counterfactual-experiment`** — from a research question and constraints, emit a complete pre-registered analysis plan: unit, pairing and matching contract, split roles, endpoints, horizon, `N`, tests, correction method, and abort/success criteria.139- **`/analyze-paired-trial`** — given branch outcomes keyed by unit, run the correct clustered/paired analysis and emit the reliability report.140- **`/audit-experiment-statistics`** — adversarially review an existing analysis, harness, or paper against the anti-pattern catalogue; severity-rated findings, each citing the sheet that fixes it.141142## Specialist Agents143144- **`agent: counterfactual-statistician`** — forward-design SME. Turns a research question into the unit definition, split plan, and pre-registration. Dispatch when designing.145- **`agent: experiment-statistics-reviewer`** — critic SME. Hunts pseudo-replication, leakage, selection bias, and calibration-on-test in designs, code, or papers. Refuses to rubber-stamp: zero findings is treated as an audit defect. Dispatch when reviewing.146147**Skills vs agents:** sheets *design* the experiment; agents *audit or produce* an artifact. Load a sheet when deciding; dispatch an agent when reviewing someone's work or when you want the pre-registration written.148149## Common Scenarios150151### Greenfield counterfactual experiment1521. [statistical-units-and-clustering](statistical-units-and-clustering.md) — name the unit, add `unit_id` everywhere1532. [common-random-numbers-and-matching](common-random-numbers-and-matching.md) — write the matching contract, wire the stream assertion into CI1543. [grouped-splits-and-leakage](grouped-splits-and-leakage.md) — assign whole units to four roles by stable hash1554. [effect-sizes-and-cost-charged-utility](effect-sizes-and-cost-charged-utility.md) — define utility with a zero-anchored control1565. [horizon-choice-and-divergence-noise](horizon-choice-and-divergence-noise.md) — pilot the `d_z` curve, pick the plateau centre1576. [power-and-sample-size-for-paired-designs](power-and-sample-size-for-paired-designs.md) — size the fleet at the UCL of `sd_d`1587. [preregistration-and-exploratory-vs-confirmatory](preregistration-and-exploratory-vs-confirmatory.md) — commit the plan, then launch159160### "Is this result real?"1611. [statistical-units-and-clustering](statistical-units-and-clustering.md) — recount `n`; this alone resolves most cases1622. [paired-comparison-methods](paired-comparison-methods.md) — was the pairing used?1633. [selection-bias-and-best-of-k](selection-bias-and-best-of-k.md) — how many candidates were tried?1644. [multiple-comparisons-and-sequential-testing](multiple-comparisons-and-sequential-testing.md) — how big was the family; was it stopped early?1655. [power-and-sample-size-for-paired-designs](power-and-sample-size-for-paired-designs.md) — at this `n`, is a significant result exaggerated?166167### "It didn't replicate"1681. [power-and-sample-size-for-paired-designs](power-and-sample-size-for-paired-designs.md) — Type-M: was the original underpowered and therefore inflated?1692. [selection-bias-and-best-of-k](selection-bias-and-best-of-k.md) — was the original a selected maximum?1703. [preregistration-and-exploratory-vs-confirmatory](preregistration-and-exploratory-vs-confirmatory.md) — were the two analyses even the same procedure?1714. [grouped-splits-and-leakage](grouped-splits-and-leakage.md) — did the original leak?172173### Designing a screener / admission gate1741. [effect-sizes-and-cost-charged-utility](effect-sizes-and-cost-charged-utility.md) — the utility it thresholds1752. [abstention-and-calibration](abstention-and-calibration.md) — calibrate, then choose the threshold by regret1763. [grouped-splits-and-leakage](grouped-splits-and-leakage.md) — fit on screen units, freeze, never touch report units1774. [selection-bias-and-best-of-k](selection-bias-and-best-of-k.md) — give the audit stage its own data178179### Writing up a fleet result1801. [frontier-and-reliability-reporting](frontier-and-reliability-reporting.md) — the six-row report over units1812. [power-and-sample-size-for-paired-designs](power-and-sample-size-for-paired-designs.md) — MDE, mandatory if the result is null1823. [anti-pattern-catalogue](anti-pattern-catalogue.md) — self-audit before publishing183184## Decision Tree185186```187Designing an experiment?188├─ Yes → units → matching → splits → utility → horizon → power → pre-register189└─ No → continue190191Auditing an existing analysis, harness, or paper?192└─ anti-pattern-catalogue, in order: units/pairing → walls → selection/testing193 → design adequacy → utility → reporting. Or dispatch194 experiment-statistics-reviewer.195196Reported n far exceeds runs launched? → statistical-units-and-clustering197Two-sample test on matched arms? → paired-comparison-methods198sd_d larger than the design predicted? → common-random-numbers-and-matching199Held-out number implausibly good? → grouped-splits-and-leakage200"Best of K" reported without K? → selection-bias-and-best-of-k201Gate can decline, graded on accuracy? → abstention-and-calibration202Many p-values, or a fleet stopped early? → multiple-comparisons-and-sequential-testing203Null with no MDE, or a fleet sized from a pilot? → power-and-sample-size-for-paired-designs204Analysis choices made after seeing results? → preregistration-and-exploratory-vs-confirmatory205Winner is the most expensive candidate? → effect-sizes-and-cost-charged-utility206Single mean standing in for a distribution? → frontier-and-reliability-reporting207Reported horizon differs from the design's? → horizon-choice-and-divergence-noise208```209210## Rationalization Resistance211212| Rationalization | Reality | Counter-guidance |213|---|---|---|214| "We have 576 data points" | You have 24, measured 24 times each | Count distinct units — [statistical-units-and-clustering](statistical-units-and-clustering.md) |215| "More branches per run is cheaper than more runs" | True, and it buys precision *within* a unit only; effective `n` saturates at roughly `G/ICC` | Branches for precision, runs for inference — same sheet |216| "It's paired, so `ttest_rel` handles it" | Pairing and clustering are separate corrections; you need both | Aggregate to one difference per unit first — [paired-comparison-methods](paired-comparison-methods.md) |217| "The task is just noisy" | Often the branches are unmatched, not the task noisy | Check the stream digests — [common-random-numbers-and-matching](common-random-numbers-and-matching.md) |218| "We only tuned the threshold on the test set once" | Once is enough; the threshold is a fitted parameter and the number is now in-sample | [grouped-splits-and-leakage](grouped-splits-and-leakage.md) |219| "Our best variant improved 3%" | With K=8 and no true effect, the winner shows 1.43 SE of pure selection | State K, audit on fresh units — [selection-bias-and-best-of-k](selection-bias-and-best-of-k.md) |220| "I'll bias-correct the winner analytically" | Corrections are unbiased under the global null and *over-correct* by more than the original bias when a candidate is genuinely good | The split is the estimator — same sheet |221| "The screener is 87% accurate" | Accuracy tracks the base rate; a gate that never acts scores well | Report regret and both baselines — [abstention-and-calibration](abstention-and-calibration.md) |222| "We only report the significant one" | 48 tests give a 91.5% chance of at least one false positive | Declare the family — [multiple-comparisons-and-sequential-testing](multiple-comparisons-and-sequential-testing.md) |223| "We stopped once the signal was clear" | Four looks turns 5% into ~13%; continuous monitoring turns it into 100% | Pre-register a spending function — same sheet |224| "It wasn't significant, so there's no effect" | At n=24 the MDE was 0.018; effects below that were invisible | Report the MDE — [power-and-sample-size-for-paired-designs](power-and-sample-size-for-paired-designs.md) |225| "The pilot showed 0.021, so we sized for that" | A pilot at 25% power exaggerates by ~1.8×, so the fleet is too small | Size from the cost model — same sheet |226| "We'll write the analysis plan after we see the data" | The p-value is a property of the procedure, and the procedure becomes unknowable | [preregistration-and-exploratory-vs-confirmatory](preregistration-and-exploratory-vs-confirmatory.md) |227| "The bigger effect at the long horizon is the real one" | Divergence noise grows faster than signal; the biggest effect is often at the least powerful horizon | [horizon-choice-and-divergence-noise](horizon-choice-and-divergence-noise.md) |228| "Loss improved by 3.8%, that's our winner" | After costs it nets +0.0029 vs +0.0116 for the "worse" candidate | Charge the costs — [effect-sizes-and-cost-charged-utility](effect-sizes-and-cost-charged-utility.md) |229| "Mean improvement is +1.2%, ship it" | A third of runs got worse and the worst decile is reliably negative | Six-row reliability report — [frontier-and-reliability-reporting](frontier-and-reliability-reporting.md) |230| "Negative results aren't worth storing" | Then the audit is unauditable and the next model trains on survivors | Negatives are output — same sheet |231232## Red Flags Checklist233234Any one of these means stop and route before believing the number:235236- [ ] **`n` exceeds the number of independent runs launched**237- [ ] **No no-op / no-intervention branch** — the counterfactual was never run238- [ ] **A two-sample test on matched arms**, or per-arm error bars compared by eye239- [ ] **Additive seeding** (`base_seed + branch_id`) or per-branch dataloaders240- [ ] **A random row-level `train_test_split`** on derived rows241- [ ] **An audit stage with a 0% historical rejection rate**242- [ ] **"Best of K" reported without K**243- [ ] **A threshold, temperature, or cost weight whose fit provenance nobody can state**244- [ ] **A results table of many p-values with the smallest one in the summary**245- [ ] **A fleet stopped early**, or a dashboard recomputing significance continuously246- [ ] **A null reported without an MDE**247- [ ] **An analysis script whose endpoint or exclusions changed after the fleet finished**248- [ ] **A leaderboard ranked on the uncharged metric**249- [ ] **A single mean per configuration**, with no `n_units`, IQR, or failure rate250- [ ] **No stored rejections, abstentions, or failures**251252## Integration with Other Skillpacks253254| Need | Pack |255|---|---|256| General A/B design, causal inference on observational data, non-paired applied stats | `yzmir-experimentation` *(planned)* |257| Which baselines a growth/morphogenesis experiment must run; comparing different-shaped checkpoints | `yzmir-morphogenetic-rl/evaluation-under-topology-change` |258| Bit-exact replay, cross-machine determinism, divergence localisation (**prerequisite for CRN**) | `axiom-determinism-and-replay` |259| Telemetry schemas that survive shape change; ablation logging | `yzmir-morphogenetic-rl/growth-telemetry-and-ablation` |260| RL algorithm choice, reward design, exploration | `yzmir-deep-rl` |261| Production monitoring, drift detection, online eval | `yzmir-ml-production` |262| Dataset/eval-set **construction** — curation, dedup tooling, label quality, synthetic-data provenance, release contract | `yzmir-ml-production/dataset-curation-and-quality` |263| Test strategy, flaky tests, coverage | `ordis-quality-engineering` |264| Writing the result up for a specific audience | `muna-technical-writer` |265266## Quick Reference267268| Need | Use this |269|---|---|270| Count `n` correctly | [statistical-units-and-clustering](statistical-units-and-clustering.md) |271| Pick and run the test | [paired-comparison-methods](paired-comparison-methods.md) |272| Make the pairing worth 6× | [common-random-numbers-and-matching](common-random-numbers-and-matching.md) |273| Keep decisions and evaluations apart | [grouped-splits-and-leakage](grouped-splits-and-leakage.md) |274| Report a selected winner honestly | [selection-bias-and-best-of-k](selection-bias-and-best-of-k.md) |275| Grade a judge that can abstain | [abstention-and-calibration](abstention-and-calibration.md) |276| Survive many tests and interim looks | [multiple-comparisons-and-sequential-testing](multiple-comparisons-and-sequential-testing.md) |277| Size the fleet / state the MDE | [power-and-sample-size-for-paired-designs](power-and-sample-size-for-paired-designs.md) |278| Freeze the plan | [preregistration-and-exploratory-vs-confirmatory](preregistration-and-exploratory-vs-confirmatory.md) |279| Decide what to measure | [effect-sizes-and-cost-charged-utility](effect-sizes-and-cost-charged-utility.md) |280| Write it up | [frontier-and-reliability-reporting](frontier-and-reliability-reporting.md) |281| Choose the evaluation horizon | [horizon-choice-and-divergence-noise](horizon-choice-and-divergence-noise.md) |282| Audit someone's analysis | [anti-pattern-catalogue](anti-pattern-catalogue.md) |283| Produce a pre-registration | command `/design-counterfactual-experiment`, agent `counterfactual-statistician` |284| Analyse a finished trial | command `/analyze-paired-trial` |285| Review an analysis adversarially | command `/audit-experiment-statistics`, agent `experiment-statistics-reviewer` |286287## The Bottom Line288289**Forking branches from a shared state buys you precision, not sample size. The independent unit is the thing you would have to launch again — the trajectory, not the branch — and every interval, every power calculation, and every split is denominated in those. Match the branches so the difference contains only the intervention; anchor against a control that scores exactly zero so "do nothing" can win; keep the data that chose a candidate away from the data that judges it; declare the plan before the data can influence it; and report the distribution over units, including the third of runs that got worse. Skip any of these and the experiment will still produce a number — it just will not be a measurement.**