01 / 21

P-Hacking &
Transparency

Understand how data manipulation inflates false discoveries, why multiple testing requires corrections, and how transparent research practices protect scientific integrity.

Biostatistics

What Is a P-Value?

A p-value measures the probability of observing data at least as extreme as what was collected, assuming the null hypothesis is true. Formally:

If \( p \leq \alpha \) (commonly \( \alpha = 0.05 \)), we reject \( H_0 \). But this threshold does not measure the probability that \( H_0 \) is false: it measures the probability of seeing such extreme data if \( H_0 \) were true.

The False Positive Problem

At \( \alpha = 0.05 \), there is a 5% chance of rejecting \( H_0 \) when it is actually true. This is a Type I error (false positive). One test alone is manageable: but what happens when we run many tests?

20 Independent Tests at \( \alpha = 0.05 \)
★ = True Null (no real effect) = False Positive
Expected false positives: \( 20 \times 0.05 = 1 \)

What Is P-Hacking?

P-hacking (also called data dredging) is the practice of manipulating data analysis until a statistically significant result (\( p \leq 0.05 \)) emerges. This can be done intentionally or unconsciously.

✕ Selective reporting
Running many outcome measures but only reporting the one with \( p < 0.05 \).
✕ Optional stopping
Checking results repeatedly and stopping data collection when \( p \) dips below 0.05.
✕ Subgroup mining
Splitting data by age, gender, region, etc. until a "significant" subgroup appears.

The Multiple Testing Problem

When you perform \( m \) independent tests, the probability of at least one false positive is called the family-wise error rate (FWER):

0% 20% 40% 60% 80% 100% FWER 0 10 20 30 40 50 Number of Tests (m)
\( m = 20 \): 64%
5%

The Bonferroni Correction

The simplest fix for multiple testing: divide your significance threshold by the number of tests. This controls the family-wise error rate.

Example
If \( \alpha = 0.05 \) and \( m = 20 \), then \( \alpha_{\text{adj}} = \frac{0.05}{20} = 0.0025 \). Each test must reach \( p \leq 0.0025 \).
Trade-off
Bonferroni is conservative: it reduces false positives but increases false negatives (misses real effects).

Bonferroni vs. FDR Correction

Two main approaches exist for multiple testing. They control different error rates and suit different research goals.

Bonferroni (FWER) Benjamini-Hochberg (FDR)
Controls Probability of any false positive Expected proportion of false positives
Formula \( \alpha / m \) Rank-based adjusted thresholds
Strictness Very strict More lenient
Best for Small number of tests, high stakes Genomics, screening many hypotheses
Risk Many false negatives Some false positives allowed

Why P-Hacking Is Dangerous

P-hacking inflates the false discovery rate, meaning published "significant" findings are often not reproducible. This has real consequences in medicine, policy, and public trust.

All Analyses Cherry-pick
\( p < 0.05 \)
Published ★ "Significant!" Replication FAILS

How to Detect P-Hacking

1
Suspiciously clustered p-values. Many results with \( p \) just below 0.05 (e.g., \( p = 0.049, 0.048, 0.047 \)) suggest selective reporting.
2
No pre-registration. If the hypothesis, sample size, and analysis plan were not registered before data collection, flexibility is high.
3
Excessive subgroup analyses. Look for many post-hoc subgroup comparisons without correction for multiple testing.
4
Unreported outcomes. If the paper mentions measuring 10 outcomes but only reports 2, ask: what happened to the other 8?

Transparency Practices

Transparent research practices protect against p-hacking and build trust in scientific findings. Here are the key pillars:

Pre-registration
Publicly declare hypotheses, methods, and analysis plans before collecting data.
Open Data
Share raw datasets so others can verify analyses and check for selective reporting.
Registered Reports
Journals accept papers before results are known, based on methodology quality alone.

How to Pre-Register a Study

1
State your hypothesis. Write a clear, testable prediction: e.g., "Drug X will reduce blood pressure by \( \geq 5 \) mmHg compared to placebo."
2
Define your sample size. Calculate using a power analysis: \( n = \left(\frac{z_{\alpha/2} + z_{\beta}}{\delta / \sigma}\right)^2 \), where \( \delta \) is the effect size.
3
Specify your analysis plan. State the exact statistical test, covariates, and how you will handle missing data.
4
Register publicly. Upload to a registry (e.g., ClinicalTrials.gov, OSF) with a timestamp before data collection begins.
5
Label exploratory findings. Any analysis not in the pre-registration must be clearly marked as exploratory in the paper.

Example: Jelly Beans & Acne

A researcher tests whether each of 20 jelly bean colors is linked to acne. Each test uses \( \alpha = 0.05 \). One color (green) yields \( p = 0.03 \). The headline reads: "Green jelly beans linked to acne!"

Example: Clinical Trial Subgroups

A drug trial for headache relief finds no overall effect (\( p = 0.32 \)). But the researchers then split by age, gender, and headache severity, yielding 12 subgroups. In women aged 40-50, they find \( p = 0.04 \).

Overall: \( p = 0.32 \)
By Gender By Age Group By Severity
Men: \( p = 0.61 \)
Women: \( p = 0.18 \)
Women 40-50: \( p = 0.04 \)
12 subgroups tested
\( \alpha_{\text{adj}} = 0.05/12 \approx 0.004 \)
\( 0.04 > 0.004 \): Not significant

Example: Optional Stopping

A researcher plans to collect \( n = 100 \) samples but checks the \( p \)-value after every 10. At \( n = 40 \), they find \( p = 0.04 \) and stop. Is this valid?

0 0.05 0.10 0.15 0.20 p-value 0 20 40 60 80 100 Sample Size (n)
\( \alpha = 0.05 \)
STOP! \( p = 0.04 \)
If continued: \( p \approx 0.15 \)

Common Mistakes

✕ Misinterpreting p-values
Saying "there is a 5% chance the null is true." P-values measure data probability under \( H_0 \), not the probability of \( H_0 \).
✕ Not correcting for multiple tests
Running 50 tests at \( \alpha = 0.05 \) without Bonferroni or FDR correction virtually guarantees false positives.
✕ Confusing exploratory with confirmatory
Presenting a post-hoc finding as if it were a pre-specified hypothesis destroys the statistical guarantee of \( \alpha \).

Summary Table

Concept What It Means How to Address It
P-hacking Manipulating analysis to get \( p < 0.05 \) Pre-registration
Multiple testing More tests = more false positives Bonferroni / FDR
Optional stopping Peeking at \( p \)-value inflates Type I error Fixed sample size
Selective reporting Only showing "significant" results Report all outcomes
Publication bias Journals prefer \( p < 0.05 \) Registered reports

Question 1 of 5

A researcher runs 40 independent tests at \( \alpha = 0.05 \). Using Bonferroni correction, what is the adjusted significance threshold?

Question 2 of 5

What is the family-wise error rate (FWER) when running 10 independent tests at \( \alpha = 0.05 \) with no correction?

Question 3 of 5

Which of the following is the best description of p-hacking?

Question 4 of 5

A study pre-registered one primary hypothesis and found \( p = 0.03 \). During analysis, they also discovered an unexpected subgroup effect with \( p = 0.01 \). How should the subgroup finding be reported?

Question 5 of 5

A clinical trial checks the \( p \)-value after every 20 patients and stops at \( n = 60 \) when \( p = 0.048 \). Which problem does this illustrate?