This week in a line: you’ll build a confidence interval and run a hypothesis test for a single population mean, using the t-distribution.
It’s a holiday-shortened week, so campus is quieter than usual, but your two biggest new statistics tools of the semester are due right on schedule. Last week you built a confidence interval and ran a hypothesis test for a single proportion — a fraction of people who do something. This week asks the parallel question about an average instead: how long does a typical nap last between classes? Is the average commute to campus really as short as the parking office claims? Both questions need the same two moves you already know — a confidence interval, then a hypothesis test — but for a mean, those moves lean on a new reference distribution, because you almost never know the population’s true spread.
1The t-distribution: the price of not knowing ¶
Back in Week 9, the standard error of a sample mean was , where (population standard deviation) was simply given. In real problems, you almost never know — all you have is your sample’s standard deviation, . Swapping in for seems harmless, but it adds a second layer of guessing on top of sampling variability: itself bounces around from sample to sample, especially when is small. To account for that extra wobble, one-mean inference uses the t-distribution instead of the Normal (z) distribution whenever is unknown — which is the normal state of affairs.
The t-distribution is bell-shaped and centered at 0, just like z, but it is flatter in the middle
and has heavier tails — more area out past or — to cover the extra
uncertainty from estimating with . Exactly how heavy the tails are depends on the
degrees of freedom, : fewer degrees of freedom (smaller samples) means heavier
tails and a wider critical value; as grows, grows, and the t-curve tightens until it is
nearly indistinguishable from z. Running R’s qt() across a range of makes the convergence
concrete:
| 5 | 10 | 20 | 30 | 50 | 100 | |
|---|---|---|---|---|---|---|
| (95% CI) | 2.571 | 2.228 | 2.086 | 2.042 | 2.009 | 1.984 |
For comparison, the Normal critical value is a fixed for a 95% interval. Notice how starts well above at and steadily closes the gap — by it is only 0.024 away from 1.960, and it would keep sliding closer as grows further. That single row of numbers is the large-sample story of this course: t and z agree closely once your sample is reasonably large, but t is the honest choice whenever is estimated rather than known.
Figure 1. A t-distribution curve overlaid on a standard Normal curve, both centered at 0 and bell-shaped, shows the t-curve sitting slightly lower at the peak and slightly higher than the Normal curve out past on both sides — the “heavier tails” that make larger than for the same confidence level.

2A confidence interval for a mean¶
Conditions first. Before building an interval, check: (1) independence — observations come from a random sample or a random process, so one value doesn’t influence another; (2) large sample or nearly normal — with the Central Limit Theorem covers you even if the data are somewhat skewed; with smaller , the sample should show no strong skew and no extreme outliers.
With those conditions met, the confidence interval for a population mean is
where is the sample mean, is the sample standard deviation, is the sample size, is the standard error of the mean, and is the critical value cut from the t-distribution with degrees of freedom at the chosen confidence level.
Figure 2. A number line from 15 to 35 minutes marking the sample mean with a dot and a horizontal bracket spanning from 20.33 to 30.67, representing the 95% confidence interval for the true mean nap length.

Figure 3. A histogram of the 24 nap lengths is mounded between about 10 and 35 minutes with a thin tail stretching out to 51 and 57 minutes — a mild right skew, consistent with the mean (25.5 minutes) sitting a bit above the median (22.5 minutes) and with the single flagged outlier at 57.

3The one-sample t-test for a mean¶
A hypothesis test for a mean checks a claim about using the same ingredients. The null hypothesis states a specific value, ; the alternative says differs from (two-sided) or is specifically greater than or less than it (one-sided). The test statistic is
and the p-value is the area under the t-curve with degrees of freedom, out past the observed in the direction(s) points. As always: small p-value (below your significance level ) means the data are surprising under , so you reject ; otherwise you fail to reject .
Large samples: why t and z nearly agree. Re-running Example 2’s exact summary statistics through the z-based equivalent (same , , and , but referenced against the Normal curve instead of ) gives — the identical test statistic value, because the formula is the same — with , versus the t-test’s . The two p-values are close enough that both lead to the same decision at , exactly the pattern the -vs- table above predicted: once is large (here ), the extra uncertainty from estimating with barely matters, and t and z tell the same story. For small samples, they can disagree more, which is why this course leads with t.
See it in R.
suppressMessages({library(mosaic); library(BSDA)})
# Worked Example 1: nap length, confidence interval from raw data
nap_minutes_sim <- c(20, 51, 18, 38, 35, 9, 28, 34, 10, 22, 19, 35,
10, 24, 9, 57, 21, 32, 23, 18, 32, 21, 26, 20)
naps <- data.frame(nap_minutes_sim)
favstats(~ nap_minutes_sim, data = naps)
t.test(~ nap_minutes_sim, data = naps, conf.level = 0.95)$conf.int
# Worked Example 2: commute time, one-sample t-test from summary stats (BSDA)
tsum.test(mean.x = 23.49, s.x = 9.39, n.x = 45, mu = 20, alternative = "greater")
# large-sample z equivalent, same summary stats (noted, not required)
zsum.test(mean.x = 23.49, sigma.x = 9.39, n.x = 45, mu = 20, alternative = "greater")t.test()$conf.int returns 20.33286 30.66714, matching Example 1’s hand-built interval.
tsum.test() returns t = 2.4933, df = 44, p-value = 0.008246, matching Example 2. zsum.test()
on the identical summary numbers returns z = 2.4933, p-value = 0.006329 — the same test
statistic, a slightly smaller p-value, and the same decision at , exactly the
t-vs-z agreement described above. Use tsum.test()/zsum.test() whenever a problem only gives
you , (or ), and rather than a raw data list.
4Check your understanding¶
A campus wellness survey plans to estimate mean daily screen time from a random sample of students. The sample’s histogram shows one clear peak, roughly symmetric shape, and no outliers. Is it reasonable to use t-procedures here? Explain using both conditions from this week (independence, and sample size/shape).
A sample of receipts at a campus café gives and . Find the standard error of the mean. (Do not build the full interval yet — just the standard error.)
A sample of phone battery-life tests gives hours and hours. Construct and interpret a 90% confidence interval for the true mean battery life.
Using the t-table row for from this week’s skills refresher, what is for a 99% confidence interval? How does it compare to the 95% value used in Worked Example 1, and why does a higher confidence level need a larger ?
A streaming service claims subscribers watch an average of 90 minutes per day. A random sample of subscribers gives minutes and minutes. Test vs. at , showing the test statistic, , p-value, decision, and a one-sentence conclusion in context.
Explain, in your own words, why is larger than for the same confidence level when is small, and why that gap shrinks as grows. Use the -vs- table from this week to support your answer.
5Key terms¶
Standard error of the mean () — ; how much sample means typically vary from the true population mean.
t-distribution — a bell-shaped distribution like the Normal curve, but with heavier tails, used for mean inference when the population SD is unknown (estimated by ).
Degrees of freedom () — for one-mean inference, ; controls how heavy the t-distribution’s tails are.
Critical value () — the t-value cutting off the confidence level’s tail area(s); larger than the matching for small , converging to it as grows.
Confidence interval for a mean — .
One-sample t-test — tests using with .
TInterval/T-Test— the TI-83/84 menu items (underSTAT ▸ TESTS) for a one-mean confidence interval and hypothesis test.t.test()/tsum.test()/zsum.test()— the matching R functions:t.test()from raw data (mosaic),tsum.test()from summary statistics, andzsum.test()as the large-sample z equivalent when is treated as known (BSDA).