01 / 21

Hypothesis Testing
& Confidence Intervals

Master statistical inference by learning to test claims about populations and construct confidence intervals that quantify uncertainty.

AP Statistics

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:

Hypothesis Testing
Decide whether sample evidence supports or contradicts a specific claim about a population parameter.
Confidence Intervals
Estimate a population parameter by giving a range of plausible values, with an associated confidence level.

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.

\(\mu\) \(-1.96\) \(+1.96\) 95% of data 2.5% 2.5%

Null & Alternative Hypotheses

Every hypothesis test begins with two competing statements about a population parameter \(\theta\) (such as \(\mu\) or \(p\)):

\(H_0\): Null Hypothesis
The "status quo" claim. Assumes no effect or no difference. We assume \(H_0\) is true unless evidence says otherwise.
\(H_1\): Alternative Hypothesis
The claim we want to test. It asserts that the parameter differs from \(H_0\). It can be one-tailed or two-tailed.

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.

\(\mu_0\) \(\bar{x}\) \(p\)-value If \(p\)-value \(< \alpha\) Reject \(H_0\)

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:

\(\bar{X}\)
Sample mean: the observed average from your data.
\(\mu_0\)
Hypothesized population mean stated in \(H_0\).
\(\sigma / \sqrt{n}\)
Standard error: the standard deviation of the sampling distribution.

Confidence Interval for \(\mu\)

A confidence interval gives a range of plausible values for the true population mean \(\mu\). At confidence level \((1 - \alpha)\):

\(\bar{x}\) Lower Upper Margin of Error Margin of Error

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.

\(\mu_0\) inside CI
\(p\text{-value} \geq \alpha\): do not reject \(H_0\). The hypothesized value is plausible.
\(\mu_0\) outside CI
\(p\text{-value} < \alpha\): reject \(H_0\). The hypothesized value is not plausible at this confidence level.

How to Conduct a Hypothesis Test

1
State the hypotheses: Write \(H_0\) and \(H_1\) in terms of the population parameter.
2
Choose significance level: Set \(\alpha\) (typically \(0.05\) or \(0.01\)) before analysing the data.
3
Compute the test statistic: Calculate \(Z = \dfrac{\bar{x} - \mu_0}{\sigma / \sqrt{n}}\) (or use \(t\) if \(\sigma\) unknown).
4
Find the \(p\)-value: Use the standard normal (or \(t\)) table/GDC to find the tail probability.
5
Make a decision: If \(p\text{-value} < \alpha\), reject \(H_0\). Otherwise, do not reject. State conclusion in context.

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?

1
Hypotheses: \(H_0\!: \mu = 500\), \(H_1\!: \mu < 500\) (one-tailed)
2
Test statistic: \(Z = \dfrac{496 - 500}{12 / \sqrt{36}} = \dfrac{-4}{2} = -2.00\)
3
\(p\)-value: \(P(Z \leq -2.00) = 0.0228\)
4
Decision: Since \(0.0228 < 0.05\), we reject \(H_0\).

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\).

1
Standard error: \(\text{SE} = \dfrac{12}{\sqrt{36}} = 2\)
2
Margin of error: \(E = 1.96 \times 2 = 3.92\)
3
Interval: \(496 \pm 3.92 = (492.08,\; 499.92)\)

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).

1
Hypotheses: \(H_0\!: \mu = 8\), \(H_1\!: \mu \neq 8\)
2
Test statistic: \(t = \dfrac{7.2 - 8}{1.6 / \sqrt{16}} = \dfrac{-0.8}{0.4} = -2.00\)
3
Degrees of freedom: \(\nu = 16 - 1 = 15\)
4
\(p\)-value: \(2 \times P(t_{15} \leq -2.00) \approx 2 \times 0.0320 = 0.0640\)
5
Decision: \(0.0640 > 0.05\), so we do not reject \(H_0\).

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)
Type I Error
Rejecting \(H_0\) when it is actually true: a false positive. Its probability equals \(\alpha\).
Type II Error
Failing to reject \(H_0\) when it is actually false: a false negative. Its probability is \(\beta\).

Common Mistakes to Avoid

✕ "Accept \(H_0\)"
We never accept \(H_0\). We only "do not reject" it: absence of evidence is not evidence of absence.
✕ Wrong CI interpretation
A 95% CI does not mean there is a 95% probability that \(\mu\) lies in the interval. The interval is fixed; \(\mu\) either is in it or not.
✕ Confusing \(\alpha\) with \(p\)
\(\alpha\) is the threshold chosen before the test; the \(p\)-value is computed from data. Compare them, do not equate them.

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?