- P-values are widely used in statistical hypothesis testing.
- They measure the probability of obtaining results as extreme as observed, assuming the null hypothesis is true.
- A smaller P-value suggests stronger evidence against the null hypothesis.
\[ P = P(T \geq t | H_0) \]
where: - \(T\) is the test statistic. - \(H_0\) is the null hypothesis.
\[ P = \int_{t}^{\infty} f(x) dx \]
where \(f(x)\) is the probability density function.
set.seed(42) before_sleep <- rnorm(30, mean = 65, sd = 10) after_sleep <- rnorm(30, mean = 72, sd = 10) t_test_result <- t.test(before_sleep, after_sleep, paired = TRUE) t_test_result$p.value # Extract the P-value
## [1] 0.1304872