Skip to content

The multiplicity ledger

CodeSplash records every hypothesis test you run. Learn to read the ledger, decide what belongs in a family, adjust p-values together, and lock a plan so that nobody can quietly change it.

Applied ~14 min9 steps

You will be able to

  • Find every test you ran on a dataset, with raw and adjusted p-values
  • Decide which tests belong in one family
  • Create and lock a confirmatory family
  • Use the Counted switch honestly

Read first

01

Six tests on one dataset

Predict

Predict first

You ran six tests on one dataset, with p-values .001.001, .012.012, .03.03, .04.04, .20.20 and .75.75. Four are below 0.05. How many stay there after a Benjamini–Hochberg adjustment at 0.05?

Make your guess between 0 and 6 tests below 0.05, then reveal.

Reveal

Two. .03.03 and .04.04 go up to .06.06. Whether they "count" depends on what else you tested alongside them, and only a record of all six can tell you that.

02

What the ledger keeps

Read

The ledgerMultiple-testing ledgerCodeSplash's record of every hypothesis test in a project, used to adjust for multiple comparisons. is the Multiple testing page in Analyze. Each hypothesis test that a saved analysis reports appears there, with these columns:

ColumnTells you
p and AdjustedThe raw value, and the value after the family's adjustment
FamilyWhich tests it's adjusted with
CountedWhether it's included in the adjustment
ExploratoryWhether it's labeled as a look you didn't plan

Each dataset starts with one automatic family: exploratory, using Benjamini–HochbergBenjamini–Hochberg procedureControls the false discovery rate by comparing sorted p-values with rising thresholds. at 0.05. Nothing needs setting up, so the count starts with your first test.

03

See the step-up

Explore

Benjamini–Hochberg is what the automatic family applies. Move the number of tests and the number of real effects, and compare what it rejects with Bonferroni.

BExplorable · The Benjamini–Hochberg step-up

How does controlling the false discovery rate find more than Bonferroni while keeping errors in check?

How many tests will Benjamini–Hochberg reject?

100
How sure?
40
8
3.0
0.10
Benjamini–Hochberg rejects 5

Commit your prediction above to see the result

Make your prediction first; the figure appears when you commit.

Make your prediction to see the result.

Notice how the threshold rises along the sorted p-values: the more small p-values you have, the more you can afford. That's why FDRFalse discovery rateThe expected share of false positives among the results you call significant. suits exploration, where you expect several real leads. A confirmatory family usually wants FWERFamily-wise error rateThe chance of at least one false positive across a family of tests. control with HolmHolm correctionA step-down version of Bonferroni that controls the same error rate with more power; use it instead..

04

By hand, once

Checkpoint

Benjamini–Hochberg on the six p-values

Sort the p-values and compare each with i6×.05\frac{i}{6} \times .05.

  1. .001≤.0083.001 \le .0083, and .012≤.0167.012 \le .0167: both pass.
  2. .03>.025.03 > .025, .04>.0333.04 > .0333, .20>.0417.20 > .0417 and .75>.05.75 > .05: all fail.
  3. Try this step yourself, then reveal it
    The largest ii that passes is 2, so reject the first two.
  4. Try this step yourself, then reveal it
    Adjusted p-values are the same idea, turned around: p(3)×6/3=.06p_{(3)} \times 6 / 3 = .06.

Check yourself

Now use Holm at α=.05\alpha = .05 on the same six p-values. How many are rejected?

Show the answer

Answer: 1

.001≤.05/6.001 \le .05/6 passes. .012>.05/5=.01.012 > .05/5 = .01 fails, so stop. One rejection: the stricter promise costs a discovery.

Python
from statsmodels.stats.multitest import multipletests

pvals = [0.001, 0.012, 0.03, 0.04, 0.20, 0.75]
print(multipletests(pvals, alpha=0.05, method="fdr_bh")[1])
print(multipletests(pvals, alpha=0.05, method="holm")[1])
R
pvals <- c(0.001, 0.012, 0.03, 0.04, 0.20, 0.75)
p.adjust(pvals, method = "BH")
p.adjust(pvals, method = "holm")
05

What makes a family?

Checkpoint

A family is the set of tests that answer one question, and whose results you'd act on together.

Check yourself

A study has one primary outcome and three secondary ones. You also ran a dozen unplanned subgroup checks. How would you organize them?

Show the answer

Answer: c

Splitting by purpose keeps planned hypotheses from paying for unplanned looks, and keeps the looks on record. A family can't be chosen by which results look good.

Check yourself

Your confirmatory family has five tests. The fifth has spoiled the adjustment, and you'd like to move it to another family. Is that fine?

Show the answer

Answer: c

Choosing the family after seeing results is p-hacking one level up. That's what locking is for.

06

Lock it

In the app

Open Multiple testing and press New family. Choose Confirmatory, an error rate and an adjustment, and add a note saying why the tests belong together. Then open the dataset's exploratory family and use the Family menu in each row to move tests in.

Open your new family and press Lock. The tests, the adjustment and α are frozen and recorded with a hash. Reruns still update the results, but no test can be added or removed, and you can't undo it. Do it before you look at the results.

07

The switch you'll be tempted by

Predict

Predict first

Counted can take a test out of the adjustment. One of your tests is pushing the others above the threshold. Can you turn its Counted switch off?

Yes: it was only a checkYes, if you delete the analysis tooOnly if it's a real sensitivity analysis, chosen on that basis
Reveal

Only if it's a real sensitivity analysis: a rerun of a planned test under another assumption, chosen for that reason and not for its effect on the numbers. The ledger keeps it either way, with a dash in Adjusted, so a reader can see what you left out.

08

It remembers your reruns

Read

Rerun an analysis with other options, and the ledger counts the newest run. The older ones stay under Earlier runs, kept for the audit trail.

When one outcome has been tried in more than three variants, the family shows a warning: "was tested in… variants… Report every variant, or pre-specify one in a confirmatory family." That's your garden of forking paths, counted for you. The ledger can't see forks that you took in your head, or in another tool. It only records what ran here.

09

Recap

Recap
  • The ledger records every test from a saved analysis, with raw and adjusted p-values, so you can always quote the denominator.
  • A family is the tests that answer one question. Choose it before results, and lock it.
  • Counted and Exploratory describe your tests, so set them by what the test is, never by what it did to the numbers.

Concepts in this lesson