Slide 01: Introduction

Slide 02: Definition (Math Slide)

The p-value is defined as:

\[ p = P(T \geq t_0\mid H_0 \text{ is true}) \]

Slide 03: Hypothesis Testing (Math Slide)

We test:

\[ H_0: \mu = \mu_0 \quad \text{vs.} \quad H_a: \mu \neq \mu_0 \]

Decision rule (for significance level \(\alpha = 0.05\)):

Slide 04: Example Data

Suppose we measure exam scores for 30 students and test whether the mean score = 75.

[1] 77.52896

    One Sample t-test

data:  scores
t = 1.412, df = 29, p-value = 0.1686
alternative hypothesis: true mean is not equal to 75
95 percent confidence interval:
 73.86573 81.19219
sample estimates:
mean of x 
 77.52896 

Slide 05: ggplot2 - Distribution of Sample

Slide 06: ggplot2 - p-value Visualization

Visualizing rejection regions for a two-sided t-test \((df=29)\):

Slide 07: ggplot2 - p-value Visualization (code)

ggplot(df_plot,
       aes(x = x,
           y = dens)) +
       geom_line(color = "blue") +
       geom_area(data = subset(df_plot,
                               is_tail),
                 aes(x = x,
                     y = dens),
                 fill = "red",
                 alpha = 0.5) +
       labs(title = paste0("Rejection Region (alpha=0.05, df=",
                           dfree, ")"),
            x = "t value",
            y = "Density") +
       theme_minimal()

Slide 08: Interactive Plot (plotly)

Interactive visualization of p-value areas:

Slide 09: 3D Plotly (Bonus)

Just a 3D version of the information in slide 07

Slide 10: Interpreting the Example

From the t-test:
- Test statistic: about 1.41
- p-value: about 0.169

Interpretation:
- If p-value < 0.05 → significant evidence against \(H_0\).
- Otherwise, no significant evidence.

Slide 11: Common Misconceptions

Slide 12: Conclusion