Introduction to Hypothesis Testing
Learn the logic of hypothesis testing and how to formulate and test statistical claims
Lesson Objectives
By the end of this lesson, you will be able to:
- Explain the logic and purpose of hypothesis testing
- Formulate null and alternative hypotheses
- Distinguish between one-tailed and two-tailed tests
- Understand the components of hypothesis testing (test statistic, significance level, critical region)
- Follow the steps of a hypothesis test
1. What is Hypothesis Testing?
Definition: Hypothesis Testing
Hypothesis testing is a statistical procedure used to test a claim or hypothesis about a population parameter based on sample data.
In everyday life, we constantly make claims and test them:
- "This new teaching method improves student test scores"
- "Women and men are paid equally for the same work"
- "This medication reduces blood pressure"
- "The coin is fair (50% heads, 50% tails)"
Hypothesis testing provides a systematic, objective way to evaluate these claims using data. Instead of relying on intuition or anecdotal evidence, we use probability and statistical reasoning.
The Logic of Hypothesis Testing
Hypothesis testing uses a form of reasoning called proof by contradiction:
- Assume the claim we want to test (null hypothesis) is true
- Collect sample data
- Calculate how likely it would be to observe our sample data if the null hypothesis were true
- If our observed data is very unlikely under the null hypothesis, we reject it
Example 1: Testing a Coin
Claim: A coin is fair (50% chance of heads).
Test: We flip the coin 100 times and get 73 heads.
Question: Is this strong enough evidence to reject the claim that the coin is fair?
Logic:
- If the coin really is fair, getting exactly 50 heads in 100 flips is unlikely
- But getting around 45-55 heads is pretty common
- Getting 73 heads is very unlikely if the coin is fair
- Conclusion: We have strong evidence the coin is NOT fair
2. Null and Alternative Hypotheses
Every hypothesis test has two competing hypotheses:
Key Definitions
Null Hypothesis (H₀): The claim being tested, usually representing "no effect," "no difference," or the status quo. It typically contains an equals sign (=).
Alternative Hypothesis (Hₐ or H₁): The claim we're trying to find evidence for. It represents "there is an effect" or "there is a difference." It uses ≠, >, or <.
Setting Up Hypotheses
| Type | Null Hypothesis (H₀) | Alternative Hypothesis (Hₐ) |
|---|---|---|
| Two-tailed test (≠) |
H₀: μ = μ₀ H₀: p = p₀ |
Hₐ: μ ≠ μ₀ Hₐ: p ≠ p₀ |
| Right-tailed test (>) |
H₀: μ = μ₀ H₀: p = p₀ |
Hₐ: μ > μ₀ Hₐ: p > p₀ |
| Left-tailed test (<) |
H₀: μ = μ₀ H₀: p = p₀ |
Hₐ: μ < μ₀ Hₐ: p < p₀ |
Example 2: Formulating Hypotheses
Scenario 1: A pharmaceutical company claims their drug lowers cholesterol. The average cholesterol level is 200 mg/dL.
- H₀: μ = 200 (the drug has no effect)
- Hₐ: μ < 200 (the drug lowers cholesterol) — left-tailed test
Scenario 2: A quality control manager wants to know if the proportion of defective products differs from the claimed 3%.
- H₀: p = 0.03 (defect rate is as claimed)
- Hₐ: p ≠ 0.03 (defect rate is different) — two-tailed test
Scenario 3: A teacher uses a new teaching method and believes it will increase test scores. The old average was 75.
- H₀: μ = 75 (no improvement)
- Hₐ: μ > 75 (test scores increased) — right-tailed test
3. One-Tailed vs. Two-Tailed Tests
Two-Tailed Test (≠)
Used when we want to detect a difference in either direction. We're testing whether the parameter is different from the claimed value, but we don't specify which direction.
Example: Is the average height of students different from 68 inches? (Could be taller OR shorter)
One-Tailed Test (< or >)
Used when we're only interested in detecting a difference in one specific direction.
- Right-tailed (>): Testing if parameter is greater than the claimed value
- Left-tailed (<): Testing if parameter is less than the claimed value
Example: Does this fertilizer increase crop yield? (Only interested in increase, not decrease)
- If the research question asks "is there a difference" or "is it different" → two-tailed
- If the question asks "is it greater" or "is it higher" → right-tailed
- If the question asks "is it less" or "is it lower" → left-tailed
4. Components of Hypothesis Testing
Test Statistic
A test statistic is a value calculated from sample data that we use to make a decision about the null hypothesis. It measures how far the sample statistic is from the hypothesized parameter.
Common test statistics:
- z-statistic: Used when population standard deviation σ is known
- t-statistic: Used when population standard deviation σ is unknown
Significance Level (α)
The significance level (α) is the probability threshold for rejecting the null hypothesis. It represents the maximum probability of making a Type I error (rejecting a true null hypothesis) that we're willing to accept.
Common values:
- α = 0.05 (5%) — most common in practice
- α = 0.01 (1%) — more stringent, used when consequences of error are serious
- α = 0.10 (10%) — less stringent, used in exploratory research
Critical Region and Critical Values
The critical region (or rejection region) is the set of test statistic values for which we reject the null hypothesis.
Critical values are the boundaries of the critical region.
If the test statistic falls in the critical region, we reject H₀.
If the test statistic does not fall in the critical region, we fail to reject H₀.
5. Steps of Hypothesis Testing
Every hypothesis test follows these systematic steps:
-
State the hypotheses
Write out the null hypothesis (H₀) and alternative hypothesis (Hₐ). Identify whether it's one-tailed or two-tailed. -
Choose significance level (α)
Select α (usually 0.05). This determines the critical region. -
Select and calculate the test statistic
Choose the appropriate test (z-test or t-test) and calculate the test statistic from your sample data. -
Find the critical value(s) or p-value
Critical value approach: Find the critical value(s) from the z or t table
P-value approach: Calculate the p-value (probability of observing data this extreme) -
Make a decision
Critical value approach: Reject H₀ if test statistic is in critical region
P-value approach: Reject H₀ if p-value < α -
State conclusion in context
Interpret the result in terms of the original research question. Use language like "there is sufficient evidence to..." or "there is not sufficient evidence to..."
Example 3: Complete Hypothesis Test Process
Research question: A cereal company claims the average weight of cereal in their boxes is 500 grams. A consumer group suspects the boxes are underfilled.
Step 1: State hypotheses
- H₀: μ = 500 (boxes contain 500 grams on average)
- Hₐ: μ < 500 (boxes are underfilled) — left-tailed test
Step 2: Choose α
- α = 0.05
Step 3: Calculate test statistic
- Sample: n = 36 boxes, x̄ = 495 grams, s = 12 grams
- We'll learn the formula in Lesson 3, but the test statistic is calculated from these values
Step 4-6: We'll complete these steps in the next lessons once we learn the formulas!
Check Your Understanding
Question 1: A researcher wants to test if a new diet pill causes weight loss. The average weight before the diet is 180 pounds. Write the null and alternative hypotheses.
Answer:
- H₀: μ = 180 (no weight loss, status quo)
- Hₐ: μ < 180 (weight loss occurred)
This is a left-tailed test because we're only interested in whether weight decreased.
Question 2: A factory produces bolts with a target diameter of 10 mm. Quality control wants to detect if the production process is producing bolts of the wrong size (either too large or too small). Write the hypotheses.
Answer:
- H₀: μ = 10 (diameter is correct)
- Hₐ: μ ≠ 10 (diameter is incorrect in either direction)
This is a two-tailed test because we want to detect deviations in either direction.
Question 3: If α = 0.05, what does this mean in plain English?
Answer:
We are willing to accept a 5% chance of rejecting the null hypothesis when it is actually true (Type I error). In other words, if we run this test 100 times and the null hypothesis is true every time, we expect to incorrectly reject it about 5 times.
Summary
- Hypothesis testing uses sample data to test claims about population parameters
- The null hypothesis (H₀) represents the status quo or claim of no effect (contains =)
- The alternative hypothesis (Hₐ) is what we're trying to find evidence for (contains ≠, <, or >)
- One-tailed tests detect effects in one direction; two-tailed tests detect effects in either direction
- The significance level (α) is the probability threshold for rejecting H₀
- Hypothesis testing follows a systematic 6-step process