Hypothesis Testing
& Confidence Intervals
Master statistical inference by learning to test claims about populations and construct confidence intervals that quantify uncertainty.
What Is Statistical Inference?
In statistics, we rarely observe an entire population. Instead, we collect a sample and use it to draw conclusions about the population. This process is called statistical inference and has two major tools:
The Normal Distribution Foundation
By the Central Limit Theorem, the sampling distribution of \(\bar{X}\) is approximately normal for large \(n\). This lets us use the standard normal \(Z\) or the \(t\)-distribution to compute probabilities.
Null & Alternative Hypotheses
Every hypothesis test begins with two competing statements about a population parameter \(\theta\) (such as \(\mu\) or \(p\)):
Understanding the \(p\)-value
The \(p\)-value measures the probability of observing data at least as extreme as the sample result, assuming \(H_0\) is true. It is not the probability that \(H_0\) is true.
One-Tailed vs Two-Tailed Tests
| One-Tailed | Two-Tailed | |
|---|---|---|
| \(H_1\) form | \(\mu < \mu_0\) or \(\mu > \mu_0\) | \(\mu \neq \mu_0\) |
| Rejection region | One tail only | Both tails |
| Critical \(z\) at \(\alpha = 0.05\) | \(\pm 1.645\) | \(\pm 1.960\) |
| When to use | Directional claim | Any difference matters |
| \(p\)-value calculation | \(P(Z \leq z)\) or \(P(Z \geq z)\) | \(2 \cdot P(Z \geq |z|)\) |
The \(Z\)-Test Statistic
When the population standard deviation \(\sigma\) is known (or \(n\) is large), the test statistic for a mean is:
Confidence Interval for \(\mu\)
A confidence interval gives a range of plausible values for the true population mean \(\mu\). At confidence level \((1 - \alpha)\):
CI & Hypothesis Testing: The Connection
Confidence intervals and hypothesis tests are two sides of the same coin. A two-tailed \(Z\)-test at significance level \(\alpha\) is equivalent to checking whether \(\mu_0\) falls inside or outside the \((1 - \alpha)\) confidence interval.
How to Conduct a Hypothesis Test
Worked Example: \(Z\)-Test
A cereal company claims the mean mass of boxes is \(\mu = 500\) g with \(\sigma = 12\) g. A sample of \(n = 36\) boxes has \(\bar{x} = 496\) g. At \(\alpha = 0.05\), is there evidence the mean is less than claimed?
Worked Example: 95% CI
Using the same cereal data: \(\bar{x} = 496\) g, \(\sigma = 12\) g, \(n = 36\). Construct a 95% confidence interval for \(\mu\).
Worked Example: \(t\)-Test (Unknown \(\sigma\))
A teacher claims students sleep \(\mu = 8\) hours per night. A sample of \(n = 16\) students gives \(\bar{x} = 7.2\) and \(s = 1.6\). Test at \(\alpha = 0.05\) (two-tailed).
Type I & Type II Errors
| \(H_0\) is True | \(H_0\) is False | |
|---|---|---|
| Do not reject \(H_0\) | Correct decision | Type II Error (\(\beta\)) |
| Reject \(H_0\) | Type I Error (\(\alpha\)) | Correct decision (Power) |
Common Mistakes to Avoid
Summary: Key Formulas & Facts
| Concept | Formula / Detail |
|---|---|
| \(Z\)-test statistic | \(Z = \dfrac{\bar{x} - \mu_0}{\sigma / \sqrt{n}}\) |
| \(t\)-test statistic | \(t = \dfrac{\bar{x} - \mu_0}{s / \sqrt{n}}\), \(\nu = n - 1\) |
| 95% CI for \(\mu\) | \(\bar{x} \pm 1.96 \cdot \dfrac{\sigma}{\sqrt{n}}\) |
| Reject \(H_0\) when | \(p\text{-value} < \alpha\) |
| Type I error prob. | \(\alpha\) |
| Type II error prob. | \(\beta\) (depends on true \(\mu\) and \(n\)) |
Question 1 of 5
A researcher tests \(H_0\!: \mu = 50\) against \(H_1\!: \mu > 50\) and obtains a \(p\)-value of 0.03. At \(\alpha = 0.05\), what is the correct conclusion?
Question 2 of 5
A 95% confidence interval for \(\mu\) is \((12.4,\; 15.6)\). Which statement is the correct interpretation?
Question 3 of 5
Given \(\bar{x} = 82\), \(\sigma = 10\), and \(n = 25\), what is the test statistic for testing \(H_0\!: \mu = 80\)?
Question 4 of 5
A Type I error occurs when:
Question 5 of 5
If we increase the sample size \(n\) while keeping everything else constant, what happens to the width of the confidence interval?