Topic contents

Lesson 1

From confidence intervals to hypothesis testing

The same statistical inference question, viewed from another direction

What happens to 95% confidence intervals over 100 samples?

Part 1 · What did we learn in the previous topic?

Continue with the male students' height example. The simulated population mean is fixed at μ = 172 cm and the population standard deviation is σ = 6 cm. Each time, independently draw a random sample of n = 100 people and calculate a 95% confidence interval.

171.97171.98171.99172.00172.01172.02172.03cmFixed true value μ = 172 cmClick a sampling button to begin.
Confidence intervals from repeated samples: one interval per sample

Each horizontal line represents an interval from one sample; blue indicates coverage of the true population value, and orange indicates a miss. The plot shows the most recent 40 samples; the statistics include all samples drawn.

xˉ±1.96×6100=xˉ±1.176\bar{x} ± 1.96 \times \frac{6}{\sqrt{100}} = \bar{x} ± 1.176
The sample mean varies from sample to sample, so the interval's position varies too
Total samples drawn
0
Covers true value
0
Observed coverage proportion
—

95% is the long-run coverage rate of this interval construction method; it does not guarantee exactly 95 intervals covering the true value in every 100 experiments.

Class discussion: The true population value never changes. Why do some intervals cover it while others miss it?

How can we assess a hypothesized value when the true population value is unknown?

Part 2 · Think from another direction

In a real survey, the true population mean is usually unknown. The sample mean is now 173 cm. Someone suggests that the population mean height may be 175.0 cm. Does this hypothesized value fall inside the 95% confidence interval calculated from the sample?

μ₀ = 175.0170172174176Sample mean 173171.824174.176
Confidence interval and hypothesized population mean

The horizontal line segment is the 95% confidence interval calculated this time; the vertical line represents the adjustable hypothesized population mean.

173±1.96×6100173 ± 1.96 \times \frac{6}{\sqrt{100}}
95% confidence interval = [171.824, 174.176] cm

The hypothesized value is outside the 95% confidence interval
175.0 ∉ [171.824, 174.176]

Class discussion: If you gradually move the hypothesized value from 175 cm toward 173 cm, when does it enter this interval?

Here we only assess whether the sample result is compatible with the hypothesized value; formal hypothesis-testing decision terms come later.

Does the hypothesized value fall inside the confidence interval? Rewrite the condition step by step

Part 3 · From an interval condition to a standardized condition

In Part 2, we used a plot to see whether the hypothesized value fell inside the interval. Now express the same question as a mathematical condition: first express the interval boundaries using a general critical value, then derive the Z statistic used for comparison.

① Write the general condition for the hypothesized value to lie inside the confidence interval
xˉ−zα/2σn≤μ0≤xˉ+zα/2σn\bar{x} - {z}_{\alpha / 2} \frac{\sigma }{\sqrt{n}} \le {\mu }_{0} \le \bar{x} + {z}_{\alpha / 2} \frac{\sigma }{\sqrt{n}}
② Rearrange and divide by the standard error σ/√n (which is greater than 0)
−zα/2≤xˉ−μ0σn≤zα/2- {z}_{\alpha / 2} \le \frac{\bar{x} - {\mu }_{0}}{\frac{\sigma }{\sqrt{n}}} \le {z}_{\alpha / 2}
③ Define the standardized statistic Z, then compare it with the critical values
Z=xˉ−μ0σnZ = \frac{\bar{x} - {\mu }_{0}}{\frac{\sigma }{\sqrt{n}}}
Use the hypothesized value μ₀ from Part 2: 175.0 cm
④ Substitute the values from the example
Z = (173 − 175.0) ÷ (6 / √100) = −2.00 ÷ 0.6 = −3.33
Sample mean 173 cm; population standard deviation 6 cm; sample size 100 people
⑤ Only after choosing a 95% confidence level do we use critical values of ±1.96
−3.33 < −1.96
The hypothesized value is outside the 95% confidence interval; Z is outside the central 95% region
Class discussion: Why derive the Z statistic first, then compare it with the critical values for the chosen confidence level?

These are equivalent expressions of the same condition. In the next part, we plot the calculated Z on the standard normal distribution. You can drag the slider to observe its position change.

Where does the Z we just derived fall on the standard normal distribution?

Part 4 · Locate Z on the distribution plot

In the previous part, we derived the Z formula from the condition for a 95% confidence interval. Now plot the calculated Z on the standard normal distribution and observe how many standard errors it lies from 0. The next part introduces an adjustable significance level.

Z=xˉ−μ0σnZ = \frac{\bar{x} - {\mu }_{0}}{\frac{\sigma }{\sqrt{n}}}
Difference between the sample mean and hypothesized value ÷ standard error
Z = (173 − 175.0) ÷ (6 / √100) = −3.33
Drag the slider below; the values and the plot on the right change together
−4−2024ZZ = −3.33
Z on the standard normal distribution
The difference between this sample mean and the hypothesized value, in standard errors, is 3.33.
Class discussion: Drag the slider and observe how Z moves. When is Z close to 0? How is it related to the hypothesized population mean?

How are the central 95% and the 5% in the two tails related?

Part 5 · Understanding the significance level

First suppose a particular population mean μ₀ is the true value. If we repeatedly draw independent samples and calculate Z = (sample mean − μ₀) ÷ standard error each time, about 95% of the Z values fall between −1.96 and 1.96, and about 5% fall beyond these limits in the two tails. In the language of the previous topic, about 95% of the sample confidence intervals cover this fixed true value and about 5% miss it.

Now focus on the central region and the two tails: Z falling inside the central 95% region is equivalent to the hypothesized value μ₀ falling inside this sample's 95% confidence interval. For the 95% example, the combined 5% in the two tails is the significance level α. When you change the confidence level, α changes accordingly. It is not "the probability that μ₀ is false." We will learn how to use it for a formal test decision in the next lesson.

Select significance level α

This sample’s Z = −3.33

−4−2024Z−1.9601.96095%2.5%2.5%
Standard normal distribution as the significance level changes

Light blue marks the central region, hatching marks the two tails, and the blue vertical line marks this sample's Z. Drag the hypothesized mean to move the blue Z marker; change the significance level to change the central region and critical values while Z stays the same.

Confidence level=1−α\text{Confidence level} = 1 - \alpha
Significance level α = 5% = 1 − 95%
Corresponding confidence level: 95%
Two-sided case: each tail contains 2.5%
Central 95%: −1.960 ≤ Z ≤ 1.960
This sample’s Z = −3.33 lies in the left tail
Class discussion: As the significance level decreases from 10% to 1%, how do the central region and critical values change?

The central 1 − α and the combined α in the two tails represent areas under the sampling distribution of the Z statistic when the hypothesized value holds. The significance level is neither "the probability that the hypothesized value is wrong" nor "the probability that this particular decision is wrong."

Lesson summary: In the previous topic, we observed whether intervals from repeated samples covered a fixed true value. In this topic, we first specify a hypothesized population mean, then calculate Z from the sample and observe whether it lies in the central region or the two tails. The next lesson introduces the null hypothesis, alternative hypothesis, and formal decision rules.