Exploring and confirming
Exploring is how you find ideas. It goes wrong only when you present what you found as what you set out to test. Learn to keep the two apart, in your data and in your wording.
You will be able to
- Say why data can't test the idea they suggested
- Label an analysis as exploratory or confirmatory
- Split data so that one idea gets a fair test
- Report an exploratory finding without overclaiming
Read first
The biggest of twenty
PredictPredict first
You compare 20 customer segments on a metric, and in truth none of them differs. You test the segment with the biggest gap. How likely is ? Assume the 20 comparisons are independent.
Make your guess between 0 and 1 chance, then reveal.
Reveal
. Testing the biggest of 20 is the same as running all 20. The search is part of the procedure, whether or not it's written down.
A story told afterwards
ReadHARKingHARKingPresenting a hypothesis that came from the results as if it had been made in advance. means hypothesizing after the results are known, then writing it up as if the hypothesis came first. It reads well, and readers can't see it.
Data can't fairly test an idea they suggested, because they were always going to agree with it. The test passes before it starts. To test the idea, you need data that played no part in suggesting it.
Two honest modes
ReadNeither mode is better. You need both, and you need to know which one you're in.
| ExploratoryExploratory analysisLooking through data to find ideas, with choices made along the way, so p-values only describe. | ConfirmatoryConfirmatory analysisTesting a stated idea with the outcome, analysis and exclusions fixed before the outcome data are seen. | |
|---|---|---|
| Purpose | Find ideas worth testing | Test one stated idea |
| Choices made | After seeing data | Before seeing data |
| p-values | Descriptive: error rates aren't controlled | Mean what they say |
| You write | "We noticed… this needs new data" | "We tested… and found…" |
Why long shots mislead
ExploreIdeas that come from exploring are mostly long shots. Set the share of real effects low, then high, and watch what share of significant results are false.
BExplorable · P(H₀ | p < .05)
When p < .05, how likely is it that there was no effect after all?
Of the results with p < .05, what share come from true nulls?
Commit your prediction above to see the result
Make your prediction to see the result.
The test has the same error rate in each case. What changes is how many of your ideas were right to start with. So a significant result from a search deserves less belief than the same p-value from a planned test of a well-grounded idea.
Split first
ReadIf you can't collect new data, split what you have before you look. Explore on one part, and test one idea on the other. This simulation compares two rates: the search on the first half, and the test of its winner on the second.
import numpy as np
from scipy import stats
rng = np.random.default_rng(1)
reps, explore_hits, confirm_hits = 2000, 0, 0
for _ in range(reps):
# 20 segments, 40 people in each half, no real differences.
a1, b1 = rng.normal(size=(40, 20)), rng.normal(size=(40, 20))
a2, b2 = rng.normal(size=(40, 20)), rng.normal(size=(40, 20))
ps = stats.ttest_ind(a1, b1, axis=0, equal_var=False).pvalue
best = ps.argmin() # search only the first half
explore_hits += ps[best] <= 0.05
confirm_hits += stats.ttest_ind(a2[:, best], b2[:, best], equal_var=False).pvalue <= 0.05
print(explore_hits / reps, confirm_hits / reps)set.seed(1)
res <- replicate(2000, {
# 20 segments, 40 people in each half, no real differences.
a1 <- matrix(rnorm(800), 40); b1 <- matrix(rnorm(800), 40)
a2 <- matrix(rnorm(800), 40); b2 <- matrix(rnorm(800), 40)
ps <- sapply(1:20, function(j) t.test(a1[, j], b1[, j])$p.value)
best <- which.min(ps) # search only the first half
c(explore = ps[best] <= 0.05, confirm = t.test(a2[, best], b2[, best])$p.value <= 0.05)
})
rowMeans(res)The search looks significant most of the time, and the fresh half stays near 5%. A split costs power, so it's for ideas, not for the final word.
Which mode is this?
CheckpointCheck yourself
An A/B test plan names conversion as the primary metric. After the test, you check eight segments and find that new users respond most. How should you report the new-user result?
Show the answer
Answer: b
Randomization protects the comparison, not the search. Report it, say how many segments you looked at, and test new users on their own next time.
Check yourself
What makes an analysis confirmatory?
Show the answer
Answer: c
Confirmatory describes the order of events. None of the other three tells you when the choices were made.
Check yourself
Which sentence reports an unplanned finding honestly?
Show the answer
Answer: c
It says what was done, how many places were searched, and what the finding is worth.
Mark it in the record
In the appIn Insights, More checks has a Quick run: it isn't saved or counted, so use it to find leads. To keep a check, open it in Analyze, and it joins the record.
Now open Multiple testing in the Analyze rail, then the dataset's family. Each test has an Exploratory switch. Turn it on for a look you didn't plan, and the analysis's tests carry an "exploratory" label in the ledger.
Recap
Recap- Data can't fairly test an idea they suggested. You need new data, or a part you set aside first.
- Exploring and confirming are both honest. Passing one off as the other isn't.
- Label exploratory results, say how many places you looked, and treat them as leads.
Concepts in this lesson