Hassan Ijaz

Ai, Web & Design
← Back to all topics
Statistical InferenceTopic 18 of 58

Hypothesis testing and p-values

Courtroom simulation game where users act as statistical judges, seeing null distribution animations and making accept/reject decisions

Concept Overview

Hypothesis testing is a systematic method for making decisions about population parameters based on sample data. It provides a framework for evaluating claims and controlling error rates.

The Testing Framework

Null Hypothesis (H₀)

  • Default position or status quo
  • What we assume is true unless proven otherwise
  • Often states "no effect" or "no difference"
  • Example: μ = μ₀ or p₁ = p₂

Alternative Hypothesis (H₁)

  • What we're trying to establish
  • Contradicts the null hypothesis
  • Can be one-sided (μ > μ₀) or two-sided (μ ≠ μ₀)
  • Determines the rejection region

The Testing Procedure

  1. State Hypotheses: Define H₀ and H₁ clearly
  2. Choose Significance Level: Set α (typically 0.05)
  3. Select Test Statistic: Z, t, χ², F, etc.
  4. Determine Rejection Region: Critical values based on α
  5. Calculate Test Statistic: From sample data
  6. Make Decision: Reject or fail to reject H₀

P-Values

P-value = Probability of observing data at least as extreme as what we saw, assuming H₀ is true

  • Measures strength of evidence against H₀
  • Smaller p-values = stronger evidence against H₀
  • Reject H₀ if p-value < α
  • Not the probability that H₀ is true!

Common Test Statistics

One Sample Mean

t = (x̄ - μ₀) / (s/√n)

Follows t-distribution with n-1 df

Two Sample Means

t = (x̄₁ - x̄₂) / SE(x̄₁ - x̄₂)

Pooled or Welch's t-test

Proportion

z = (p̂ - p₀) / √[p₀(1-p₀)/n]

Normal approximation for large n

Decision Outcomes

Decision \ Truth

H₀ True

H₁ True

Fail to Reject H₀

Correct (1-α)

Type II Error (β)

Reject H₀

Type I Error (α)

Correct (Power)

Courtroom Analogy: H₀ is "innocent until proven guilty." We need strong evidence (small p-value) to reject innocence and conclude guilt.

The courtroom simulation below lets you act as a statistical judge. See null distribution animations and make accept/reject decisions based on evidence strength.

Interactive Visualization

Loading interactive visualization...

Courtroom simulation game where users act as statistical judges, seeing null distribution animations and making accept/reject decisions