Introduction

This presentation explores hypothesis testing through the lens of a medical trial. We’ll use statistical tools to test if a new drug significantly reduces blood pressure compared to a placebo.

What is Hypothesis Testing?

In statistics, hypothesis testing is a method for evaluating a claim about a population using sample data.

We begin with two opposing hypotheses:

\[ H_0: \mu = \mu_0 \quad \text{(no effect)} \\\\ H_A: \mu \ne \mu_0 \quad \text{(drug has an effect)} \]

Understanding Errors and Significance

We define:

  • \(\alpha\): probability of Type I error (false positive)
  • \(\beta\): probability of Type II error (false negative)
  • p-value: probability of observing results as extreme as ours under \(H_0\)

\[ \text{p-value} = P(\text{data} \mid H_0 \text{ is true}) \]

Simulated Drug Trial: R Code

set.seed(301)
control <- rnorm(50, mean = 130, sd = 10)
treatment <- rnorm(50, mean = 122, sd = 10)
data <- data.frame(
  group = rep(c("Placebo", "NewDrug"), each = 50),
  bp = c(control, treatment)
)

Simulated Drug Trial: Sample Output

group bp
Placebo 132.4586
Placebo 101.4281
Placebo 132.9014
Placebo 134.2551

Visualization: Boxplot Distribution

Visualization: Density Curve

Interactive Plot: Mean Difference Surface

We bootstrap mean differences between groups and show them as a 3D plot.

Summary of t-test Results

  • p-value: 7.89^{-6}
  • 95% Confidence Interval: -12.41 to -5.06
  • Mean in NewDrug Group: 120.87
  • Mean in Placebo Group: 129.6

Conclusion

  • The new drug significantly reduced blood pressure (p < 0.05)
  • We reject the null hypothesis \(H_0\)
  • Visual and statistical tools confirm the drug’s effect

Final Thoughts

Hypothesis testing is a core tool in medical and scientific analysis.
Using ggplot2, plotly, and t.test() in R helps present data transparently and interactively.