Slide 1 -Title and Overview

What this presentation covers:

  • Meaning of the p-value
  • Mathematical definition
  • Visual intuition using plots
  • Example and interpretation

Slide 2 - What is a p-value?

A p-value is the probability of observing data at least as extreme as the observed data, assuming the null hypothesis is true.

Smaller p-values indicate stronger evidence against the null hypothesis.

Slide 3 - Hypotheses (LaTeX)

\[ H_0: \mu = \mu_0 \]

\[ H_A: \mu \neq \mu_0 \]

We reject \(H_0\) if the p-value is smaller than the significance level \(\alpha\).

Slide 4 - Test Statistic (LaTeX)

For a one-sample t-test:

\[ t = \frac{\bar{x} - \mu_0}{s / \sqrt{n}} \]

The two-sided p-value is:

\[ p = 2 \cdot P(T_{n-1} \ge |t|) \]

Slide 5 - Example Setup

  • Null hypothesis: \(H_0: \mu = 100\)
  • Alternative hypothesis: \(H_A: \mu \neq 100\)
  • Significance level: \(\alpha = 0.05\)

We simulate a sample to demonstrate.

Slide 6 - R code: simulate data and compute test stats

# Load tidyverse for tibble and ggplot helpers
library(tidyverse)

# Reproducibility
set.seed(2026)

# Parameters
n <- 25
mu0 <- 100
true_mu <- 103
sd_true <- 10

# Simulate sample and create x_df (needed by later ggplot chunks)
x <- rnorm(n, mean = true_mu, sd = sd_true)
x_df <- tibble(x = x)

# Compute summary and test statistic values used later
xbar <- mean(x)
s <- sd(x)
t_obs <- (xbar - mu0) / (s / sqrt(n))
df <- n - 1
p_val <- 2 * (1 - pt(abs(t_obs), df))

# Print a compact summary for the slide
tibble(
  n = n,
  sample_mean = round(xbar, 3),
  sample_sd = round(s, 3),
  t_obs = round(t_obs, 3),
  df = df,
  p_val = signif(p_val, 3)
)
## # A tibble: 1 × 6
##       n sample_mean sample_sd  t_obs    df p_val
##   <dbl>       <dbl>     <dbl>  <dbl> <dbl> <dbl>
## 1    25        99.7      9.62 -0.154    24 0.879

Slide 7 - ggplot Histogram

Slide 8 - ggplot t-distribution

Slide 9 - Static p-value heatmap

Slide 10 - Interpretation

Observed t-statistic: -0.154
Two-sided p-value: 0.879

If the p-value is less than 0.05, we reject the null hypothesis.

Slide 11 - Conclusion

  • The p-value measures evidence against the null hypothesis
  • It depends on the test statistic and sample size
  • Visualization helps understanding