2024-10-16

Slide 1: Introduction to P-Value

  • The p-value helps to determine the significance of your results in hypothesis testing.
  • It is the probability of obtaining test results at least as extreme as the results actually observed, under the assumption that the null hypothesis is correct.
  • Key Idea: A small p-value suggests that the null hypothesis may not hold.

Slide 2: P-Value Formula

  • The p-value is computed as:

\[ P = P(T \geq t | H_0) \]

where: - \(t\) is the observed test statistic - \(H_0\) is the null hypothesis

Slide 3: Example of Hypothesis Testing

  • We are testing if the mean of a sample is equal to a given value \(\mu_0\).
  • Null Hypothesis \(H_0: \mu = \mu_0\)
  • Alternative Hypothesis \(H_1: \mu \neq \mu_0\)

Slide 4: R Code to Compute P-Value

set.seed(123)

sample_data <- rnorm(30, mean = 5, sd = 2)

t_test_result <- t.test(sample_data, mu = 5)

t_test_result$p.value
## [1] 0.7944204

Slide 5: ggplot2 Visualization of P-Value

Slide 6: Boxplot of Sample Data

Slide 7: Plotly 3D Visualization of Hypothesis Test

Slide 8: Conclusion

  • The p-value provides an essential tool for hypothesis testing.
  • A p-value below a significance level (e.g., 0.05) suggests rejecting the null hypothesis.
  • Visualizing the p-value can give us more intuition about the hypothesis test.