Interview's MateData Science
Interview's Mate

Data Science

Python → ML → MLOps

Visualizer

DSA Visualizer
All 32 lessons
Custom Playground
Try your own examples

Learning

System Design
31 architecture topics
SQL Learning
160 foundations → production topics
AI Engineering
160 LLM → backend topics
Data Science
160 Python → MLOps topics
Data Engineer
160 SQL → streaming topics
Docker
160 Docker learning topics
Kubernetes
160 K8s fundamentals → cloud
Java LearnSoon
Coming soon
Python Learn
Interview Q&A & internals
JavaScript Learn
Closures, async & DOM Q&A
Tech Learn
Search, practise & track Q&A
AI DSA Practice
Solve coding problems
Theme
Home
Data Science topics
Lesson 52/ 160
03. Mathematics & Statistics

P-values & Statistical Significance

Interpret p-values without magical thinking and set alpha thoughtfully for decisions.

Intermediatep-value · Alpha3 quiz questions
Practice Generative AI Q&A
In plain wordsDiagramTheoryStep by stepWhen to use itInterview cluesMistakes to avoidQuiz (3)Practice

In plain words

The p-value says how surprising your data would be if nothing were really going on; a very small number means it would be very surprising.

Think of it like…

A smoke alarm with a set sensitivity: p-value is how unusual the smoke reading is if there's no fire. A very unusual reading makes you suspect a fire, but it doesn't tell you the fire's size, and if you install 20 alarms, one will probably ring falsely.

Where you’ve seen it

A growth team runs 20 tests of small UI changes at α = 0.05 with no true effects. The chance of at least one false positive is 1 − 0.95²⁰ ≈ 64%, so one "significant" result is expected even if nothing works. With a Bonferroni correction the threshold becomes 0.05 / 20 = 0.0025. Separately, an experiment with 1,000,000 users per arm finds conversion 10.0% vs 10.1% with p ≈ 0.018: statistically significant, yet a 0.1-point lift that may not justify engineering cost, so the team looks at the interval and the business value before shipping.

Words you’ll hear

p-value
P(data at least this extreme | H₀ true).
Significance level α
Pre-chosen cut-off for calling a result significant; the accepted false-positive rate.
Multiple comparisons
Running many tests inflates the chance of at least one false positive.
Effect size
The magnitude of a difference or relationship, independent of sample size.

Visual diagram

Loading interactive diagram

Theory & deep dive

The correct reading

Formally, p = P(test statistic at least as extreme as observed | H₀). If p = 0.018, then if there truly were no effect, you'd see data this extreme about 1.8% of the time. That says the data are unlikely under H₀, which is evidence against it, but not how likely H₀ is: that would need a prior (a Bayesian posterior), and the answer depends on how plausible the effect was before the test. A p-value of 0.04 for a surprising claim (a homeopathic remedy works) leaves H₀ more probable than not; the same p for a plausible, well-motivated hypothesis is stronger evidence.

Because p depends on sample size, a tiny effect gives a tiny p with enough data, and a large effect may give p > 0.05 with little data. Always pair p with an effect size (difference, relative lift, Cohen's d) and a confidence interval, and ask whether the interval contains effects that would matter in practice. "Statistically significant" and "practically significant" are different questions.

Same lift, different p-values

A 1-point lift in conversion (10% → 11%) gives p ≈ 0.4 with 1,000 users per arm and p < 0.001 with 20,000 per arm. The effect is identical; only the certainty changed.

Key takeaway: p = P(data | H₀); it says nothing about effect size or the probability H₀ is true.

Multiple testing, p-hacking and better practice

If you run m independent tests at level α with all nulls true, the probability of at least one false positive is 1 − (1 − α)ᵐ: 14% for 3 tests, 64% for 20, 99.4% for 100. Corrections control this: Bonferroni (use α/m; simple, conservative), Holm (a uniformly more powerful step-down version) and false discovery rate control (Benjamini-Hochberg) when screening many hypotheses and tolerating some false leads. Decide the primary metric and number of comparisons before the experiment; treat other results as exploratory.

p-hacking means exploiting analytic flexibility: trying subgroups, outcome definitions, outlier rules or stopping times until p < 0.05. It produces findings that fail to replicate. Defences: pre-register analysis plans, limit forking paths, report all tests run, use holdout data or replication for exploratory discoveries, and favour estimation (intervals, effect sizes) over dichotomous verdicts. Choose α to reflect costs: a medical safety claim may need 0.001, an inexpensive reversible UI tweak might accept 0.10.

False discovery control in code

from statsmodels.stats.multitest import multipletests; reject, p_adj, *_ = multipletests(pvals, alpha=0.05, method="fdr_bh") returns adjusted p-values and which hypotheses to call discoveries at 5% FDR.

Key takeaway: Adjust for multiple comparisons, avoid analytic flexibility, and report estimates with the p.

How it works, step by step

Step 1 of 4
Plan

1. Fix α and the family of tests

Choose α from the cost of errors and decide in advance the primary test and the number of comparisons.

α = 0.05 · 1 primary metric
Key numbers at this step
Pre-register
the plan

When to use it & trade-offs

What it is

The p-value is the probability of seeing a result at least as extreme as the one observed, assuming the null hypothesis is true. A small p-value means the data would be surprising under H₀. A result is statistically significant when p ≤ α, the threshold you set in advance (commonly 0.05). A p-value is not the probability that H₀ is true, not the probability the result is due to chance, not the size or importance of an effect, and not a measure of reproducibility. It's one piece of evidence that must be read with the effect size, interval and context.

Why it matters: p-values are the most used and most misinterpreted number in analytics. Treating p < 0.05 as proof and p > 0.05 as nothing, ignoring that tests run in bulk will find "significant" results by luck, and confusing significance with importance all lead to bad decisions and irreproducible findings. The American Statistical Association issued a formal statement in 2016 warning against these habits, and interviewers regularly test whether you know the correct reading.

When to reach for it

  • Reading and writing experiment results responsibly
  • Screening many metrics or segments
  • Explaining results to non-statisticians

When to avoid or be careful

  • Describing p as the probability the null is true
  • Slicing data until something is significant
  • Treating p = 0.049 and p = 0.051 as opposite conclusions

Multiple-testing approaches

No correction
Best for: A single pre-specified test

Strengths: Maximum power.

Watch out: False positives accumulate across many tests.

Bonferroni / Holm
Best for: Few tests where any false positive is costly

Strengths: Strict family-wise error control.

Watch out: Conservative with many tests.

FDR (Benjamini-Hochberg)
Best for: Screening many hypotheses

Strengths: More power; controls the share of false discoveries.

Watch out: Allows some false positives by design.

Interview signals & numbers to know

When this topic comes up

  • “What does a p-value of 0.03 mean?”
  • “We tested 30 segments and found one significant”
  • “Significant but tiny”
  • False discovery rate
  • Reproducibility concerns

Benchmarks & rules of thumb

64% -
chance of at least one false positive in 20 tests at α = 0.05
0.0025 -
Bonferroni threshold for 20 tests
2016 -
year of the ASA statement on p-values

Common mistakes & follow-ups

Common interview mistakes

  • Telling stakeholders "there's a 98% chance the redesign works" from p = 0.02.
  • Testing 30 segments and presenting the one with p < 0.05 as a finding.
  • Ignoring the effect size when a million-user test gives p = 0.01.

Likely interviewer follow-ups

  • What is a p-value, precisely?
  • What is the multiple comparisons problem and how do you handle it?
  • Can a result be significant but unimportant?
Interview tip: Say "the probability of data this extreme if nothing is going on". That precise phrase answers the most common interview question correctly.

Knowledge check

Loading quiz

Put it into practice

Practice related interview Q&A

Apply P-values & Statistical Significance with data science interview Q&A and hands-on practice.

Open Data Science Q&A →Machine Learning Q&A
Previous topic
Hypothesis Testing & Null vs Alternative
Next topic
Type I & Type II Errors & Statistical Power