2024-10-20

Introduction

  • Hypothesis testing is a fundamental aspect of statistics.
  • The p-value helps determine whether observed data deviates significantly from the null hypothesis.

What is a P-Value?

  • A p-value is the probability of obtaining results as extreme as those observed, assuming the null hypothesis is true.
  • It helps to quantify the strength of evidence against the null hypothesis.

Hypothesis Testing Overview

  • Null Hypothesis (H₀): There is no effect or difference.
  • Alternative Hypothesis (H₁): There is an effect or difference.
  • The p-value helps decide whether to reject H₀ in favor of H₁.

P-Value Threshold

  • Significance Level (α): Usually set to 0.05.
  • If p-value < α, reject H₀ (evidence suggests H₁ is true).
  • If p-value > α, fail to reject H₀ (evidence is insufficient).

Example Scenario

  • Testing whether a sample mean differs from a known population mean.
  • Dataset: Randomly generated sample data.
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   30.33   43.29   49.26   49.53   54.89   67.87

Visualizing P-Value (Plotly 3D Plot)

Example Calculation

  • R Code: Conducting a hypothesis test.
t_result <- t.test(sample_data, mu = 52)
t_result
## 
##  One Sample t-test
## 
## data:  sample_data
## t = -1.3796, df = 29, p-value = 0.1783
## alternative hypothesis: true mean is not equal to 52
## 95 percent confidence interval:
##  45.86573 53.19219
## sample estimates:
## mean of x 
##  49.52896

ggplot Plot 1 - Sample Data

ggplot Plot 2 - Test Statistic

Latex Math Text Slide 1

The formula for the t-statistic:

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

Where: - \(\bar{x}\): Sample mean - \(\mu\): Population mean - \(s\): Standard deviation - \(n\): Sample size

Latex Math Text Slide 2

  • P-value is calculated from the cumulative distribution function (CDF) of the t-distribution.

\[ P(T \geq t_{obs}) \]

Conclusion

  • The p-value is an important tool to decide whether to reject the null hypothesis.
  • It does not measure the size of an effect, only the evidence against H₀.

References and Resources

  • Various online articles and resources.