2024-09-23

What is p-value?

  • The p-value is the probability of obtaining results at least as extreme as the observed results, under the assumption that the null hypothesis is true.
  • It helps in determining the statistical significance of results.
  • Common threshold values for significance: 0.05 or 0.01.

Using p-values in Hypothesis Testing

The p-value helps us decide whether to reject the null hypothesis \(H_0\):

\[ H_0: \text{The results are due to chance.} \]

If the p-value is small enough (below 0.05), we reject \(H_0\) and say the results are statistically significant.

T-distribution

Shading p-values in the t-distribution

In this example, we’ll create the same t-distribution but shade the areas where the p-value would be.

Boxplot of Random P-values

T-distribution Formula

\[ t = \frac{\bar{X} - \mu}{\frac{s}{\sqrt{n}}} \]

Where: - \(\bar{X}\) is the sample mean, - \(\mu\) is the population mean, - \(s\) is the sample standard deviation, and - \(n\) is the sample size.

R Code for Boxplot

p_values_boxplot <- runif(100, 0, 1)
ggplot(data.frame(p_values_boxplot), aes(x = "", y = p_values_boxplot)) +
  geom_boxplot(fill = "lightblue") +
  labs(title = "Boxplot of Random P-values", y = "p-value", x = "")