This slideshow will cover the p-value and its significance in statistics, mainly hypothesis testing.
2025-03-16
This slideshow will cover the p-value and its significance in statistics, mainly hypothesis testing.
A p-value measures the probability of obtaining an extreme result under the null hypothesis.
Lower p-values suggest stronger evidence against \(H_0\).
Key rule: If \(p < \alpha\), typically 0.05, we reject \(H_0\).
Hypothesis testing determines if there is enough evidence to reject the null hypothesis.
It involves:
The p-value is crucial in hypothesis testing.
The test statistic for a one-sample t-test is:
\[ t = \frac{\bar{x} - \mu_0}{s / \sqrt{n}} \]
where: \(\bar{x}\) is the sample mean, \(\mu_0\) is the hypothesized population mean, \(s\) is the sample standard deviation, \(n\) is the sample size.
This 3D plot (plotly) shows how sample size affects p-values.
When a sample size is small, p-values tend to be large, meaning we fail to reject more often
A simple line plot showing how p-values decrease as sample size increases.
A histogram showing the distribution of p-values from 100 t-tests.
library(ggplot2)
# Generate random p-values from simulated t-tests
set.seed(123)
p_values <- replicate(100, t.test(rnorm(30))$p.value)
data <- data.frame(p_values)
ggplot(data, aes(x = p_values)) +
geom_histogram(binwidth = 0.05, fill = "blue", color = "black") +
labs(title = "Histogram of Simulated P-Values",
x = "P-Value",
y = "Frequency")