2026-09-16

Foundations of Hypothesis Testing

Hypothesis testing is a formal statistical framework used to make inferences about population parameters based on sample data.

  • Null Hypothesis (\(H_0\)): The baseline statement claiming no effect , no change, or status quo.
  • Alternative Hypothesis (\(H_a\)): The statement reflecting the claim we seek evidence to support.

We gather a sample to evaluate if the evidence is strong enough to reject \(H_0\).

Setting Up a Formal Framework

Consider a standar one-sample \(z\)-test evaluating a population mean \(\mu\) against a specific baseline value \(\mu_0\):

\[H_0 \mu = \mu_0\] \[H_a: \mu \neq \mu_0\]

Assuming standard conditions are met, our test statistic follows a standard normal distribution under the null hypothesis:

\[Z = \frac{\bar{X}$ - \mu_0}{\sigma/ \sqrt{n}} \sim N(0, 1) \]

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

Decisions, p-Values, and Errors

We evaluate our calculated test statistics against a predefined threshold:

  • Significance Level (\(\alpha\)): The probability of committing a Type I Error (rejecting a true \(H_0\)). Typically set to \(0.05\). _ The \(p\)-value: The probability of obtaining a test statistic at least as extreme as the observed value, assuming \(H_0\) is true.

\[\text{If } p\text{-value} \leq \alpha \implies \text{Reject } H_0\] \[\text{If } p\text{-value} > \alpha \implies \text{Fail to Reject } H_0\]

Analyzing Simulated Sample Data

Let’s test if a sample of exam scores deviates significantly from a historical mean score of \(\mu_0 = 70\).

## 
##  One Sample t-test
## 
## data:  scores
## t = 2.2373, df = 49, p-value = 0.02985
## alternative hypothesis: true mean is not equal to 70
## 95 percent confidence interval:
##  70.37082 76.91574
## sample estimates:
## mean of x 
##  73.64328

ggplot2: Visualizing Sample Distribution

Here is a look at our sample distribution with a reference line marking the historical population mean (\(\mu_0 = 70\)).

ggplot2: The Rejection Region Concept

This plot maps a theoretical normal sampling distribution curve, highlighting the boundaries of our critical regions.

Interactive Plotly Sample Inspector

This interactive jitter plot allows users to hover over individual sample scores to view their specific data values.