2026-06-05

What is Hypothesis Testing?

Hypothesis testing is a statistical method used to determine whether there is enough evidence to support a claim.

Null and Alternative Hypotheses

The null hypothesis represents the default claim.

\[ H_0 : \mu = \mu_0 \]

The alternative hypothesis represents the competing claim.

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

Test Statistic

A test statistic measures how far the sample result is from the null hypothesis.

\[ z = \frac{\bar{x}-\mu_0}{\sigma/\sqrt{n}} \]

where:

\(\bar{x}\) = sample mean

\(\mu_0\) = hypothesized mean

\(\sigma\) = population standard deviation

\(n\) = sample size

Normal Distribution

The normal distribution is useful in hypothesis testing because many test statistics follow an approximately normal shape.

Sample Data

Suppose we collected the following exam scores from a sample of students.

##   Student Score
## 1       A    72
## 2       B    85
## 3       C    91
## 4       D    78
## 5       E    88

Interactive plotly example

R Code Example

The following code calculates the average score from our sample data.

sample_data <- data.frame(
  Student = c("A", "B", "C", "D", "E"),
  Score = c(72, 85, 91, 78, 88)
)

mean(sample_data$Score)
## [1] 82.8

Conclusion

  • Hypothesis testing helps determine whether there is enough evidence to support a claim.
  • The null and alternative hypotheses provide the framework for statistical decision making.
  • Test statistics and probability distributions help evaluate sample results.
  • R and Plotly can be used to analyze data and create both static and interactive visualizations.
  • These tools allow us to communicate statistical findings clearly and effectively.