What is Hypothesis Testing?

  • Hypothesis testing is a statistical method used to evaluate a claim about a population.
  • We begin with two competing statements:
    • Null hypothesis: \(H_0\)
    • Alternative hypothesis: \(H_a\)
  • Sample data is used to decide whether there is enough evidence against \(H_0\).

Basic Idea

  • The null hypothesis usually represents “no effect” or “no difference.”
  • The alternative hypothesis represents the claim we want evidence for.
  • We calculate a test statistic and a p-value.
  • A small p-value suggests the observed result would be unlikely if \(H_0\) were true.

Mathematical Framework

For a one-sample mean test:

\[ H_0: \mu = 10 \]

\[ H_a: \mu \neq 10 \]

We compute a test statistic:

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

Where: - \(\bar{x}\) = sample mean - \(\mu\) = hypothesized mean - \(s\) = sample standard deviation - \(n\) = sample size

Decision Rule

  • We calculate a p-value
  • The p-value tells us how likely our result is under \(H_0\)

Decision:

\[ \text{Reject } H_0 \text{ if } p < 0.05 \]

  • Small p-value means stronger evidence against \(H_0\)
  • Large p-value means not enough evidence to reject \(H_0\)

Example Setup

We test whether students study more than 10 hours per week.

R Code Example

t.test(study_hours, mu = 10)
## 
##  One Sample t-test
## 
## data:  study_hours
## t = 2.9274, df = 29, p-value = 0.006586
## alternative hypothesis: true mean is not equal to 10
## 95 percent confidence interval:
##  10.33180 11.87036
## sample estimates:
## mean of x 
##  11.10108

ggplot Histogram

ggplot Scatterplot

Interactive Plotly Plot

Results

##        t 
## 2.927376
## [1] 0.006586154
## [1] 11.10108

Conclusion

  • Hypothesis testing helps evaluate claims using data.
  • We tested whether students study more than 10 hours per week.
  • The graphs and test results help support the conclusion.
  • This method is widely used in science, business, and education.

Why It Matters

  • It supports evidence-based decision making.
  • It helps researchers and analysts test claims objectively.
  • It is one of the most important tools in statistics.