Menu

Hypothesis Testing and Confidence Intervals

Lesson 4: Hypothesis Testing and Confidence Intervals

What is hypothesis testing?

Hypothesis testing is a framework for evaluating whether data provides evidence against a stated null hypothesis.

It does not:

  • Prove that a new feature works
  • Prove that a difference matters to the business
  • Tell you the probability that your idea is correct

Typical steps:

  1. State the null (H₀) and alternative (H₁) hypotheses
  2. Choose a significance level (α), often 0.05
  3. Choose an appropriate test
  4. Collect data and calculate the test statistic and p-value
  5. Interpret the result alongside the effect size and confidence interval

Null and alternative hypotheses

Hypothesis

States

Example (A/B test)

Null (H₀)No difference or no effectNew checkout page has the same conversion rate as the old one
Alternative (H₁)The effect being investigatedConversion rates differ

Define hypotheses before looking at results. Otherwise it's tempting to pick whichever comparison looks best (p-hacking).

Common tests:

Test

Use case

t-testCompare means of two groups
Chi-square testCompare proportions or categories
Two-proportion z-testCompare conversion rates
ANOVACompare means of three or more groups
Mann–Whitney UCompare two groups without assuming normality

P-values and significance

  • A p-value measures how surprising the observed result (or something more extreme) would be if the null hypothesis and model assumptions were true.
  • It is not the probability that the null hypothesis is true.
  • If p < α (e.g., 0.05), the result is called "statistically significant".

Error type

What happens

Example

Type I (false positive)Reject H₀ when it's actually trueLaunching a feature that doesn't really help
Type II (false negative)Fail to reject H₀ when there is a real effectAbandoning a feature that actually works
  • Statistical power is the probability of detecting a real effect of a given size. Small samples have low power.
  • Running many tests increases the chance of false positives. Adjust or pre-register comparisons.

Confidence intervals

  • A confidence interval gives a range of plausible values for an effect under a specified procedure.
  • It shows both direction and precision.
  • Width depends on:
    • Sample size (bigger → narrower)
    • Variability (more variable → wider)
    • Confidence level (99% → wider than 95%)

Interval for uplift

Interpretation

+1.2 to +2.8 pointsLikely positive, reasonably precise
−0.1 to +0.9 pointsIncludes zero: could be no effect
−3.0 to +5.0 pointsVery uncertain: need more data

Common mistakes

  • Significant ≠ important. A tiny effect can be significant with huge samples.
  • Not significant ≠ no effect. The test may simply lack power.
  • Reporting only "significant / no t significant". Report:
    • Effect size
    • Confidence interval
    • Sample size and context
    • Key assumptions
  • Stopping a test early as soon as it looks significant inflates false positives.

Try it: A test estimates that a change improved conversion by 0.4 percentage points, with a confidence interval from −0.1 to 0.9 points. Explain why the result is uncertain.


Data Analytics Tutorial



Learn via Video Course

Data Analysis and Processing with Python using Pandas - Data Science Course Logo

Data Analysis and Processing with Python using Pandas - Data Science Course

5 hrs



Get in Touch For Details