What this presentation covers:
- Meaning of the p-value
- Mathematical definition
- Visual intuition using plots
- Example and interpretation
What this presentation covers:
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.
\[ 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\).
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|) \]
We simulate a sample to demonstrate.
# 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
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.