MaizePrepSTATS 250
Exam 1 · Lec 07

The t-test for a mean

Tests for μ\mu with an estimated SD: the t-statistic, n−1n-1 degrees of freedom, reading t.test output, paired differences, and how nn and σ^\hat\sigma move t and p.

30 min

Key ideas

Standard error of μ^\hat\mu

σ^/n\hat\sigma/\sqrt n: the estimated SD of the sample mean. Replacing σ\sigma with σ^\hat\sigma is what turns a z-score into a t-statistic.

t-distribution

Centered at 0, symmetric, heavier tails than the standard normal; closer to normal as df =n−1= n-1 grows. p-values come from pt, not pnorm.

Conditions

A random sample, and n≥25n \ge 25 or an approximately normal population, so the CLT applies.

Paired data

When each unit is measured twice (before/after, with/without), compute one difference per unit and run a one-sample t-test on the differences. μ\mu is then the true mean difference, and the null value is usually 0.

Reading t.test

The output gives t, df, the p-value for the stated alternative, an interval and the sample mean. Check that the alternative line matches HaH_a.

Formulas

t-statistic
t=μ^−μ0σ^/n,df=n−1t=\frac{\hat\mu-\mu_0}{\hat\sigma/\sqrt n},\qquad df=n-1
On the help card.
p-values in R
pt(t, df, lower.tail = FALSE)or2×pt(-|t|, df)\texttt{pt(t, df, lower.tail = FALSE)}\quad\text{or}\quad 2\times\texttt{pt(-|t|, df)}
Exam 1 shows the p-value rather than asking for R syntax.
Worked example

Drive-through waits

A coffee chain advertises an average drive-through wait of 4.0 minutes. A regional manager thinks waits at her stores are longer and times a random sample of 36 orders. Interpret the output.

t.test(wait, mu = 4, alternative = "greater")

	One Sample t-test

data:  wait
t = 2.5, df = 35, p-value = 0.008628
alternative hypothesis: true mean is greater than 4
95 percent confidence interval:
 4.162086      Inf
sample estimates:
mean of x 
      4.5 
  1. Parameter: μ\mu = the true mean drive-through wait, in minutes, for all orders at this manager's stores. H0:μ=4H_0: \mu = 4 versus Ha:μ>4H_a: \mu > 4.

  2. Condition: random sample with n=36≥25n = 36 \ge 25.

  3. Statistic: t=2.5t = 2.5 with μ^=4.5\hat\mu = 4.5, so SE =0.5/2.5=0.2= 0.5/2.5 = 0.2 and σ^=0.236=1.2\hat\sigma = 0.2\sqrt{36} = 1.2. The sample mean wait is 2.5 standard errors above the hypothesized 4 minutes.

  4. p-value: assuming the true mean wait is 4 minutes, the chance of a t-statistic of 2.5 or larger is about 0.0086.

Answer

Very strong evidence that the true mean drive-through wait at these stores is greater than 4 minutes.

Check yourself

1
Lec 07

A sample of 16 bike commutes has μ^=47\hat\mu = 47 minutes and σ^=8\hat\sigma = 8 minutes. Compute the t-statistic for H0:μ=50H_0: \mu = 50. Give the exact value.

Math shortcuts are on for STATS 250. Type ^ then digits for powers, _ then digits for subscripts.
2
Lec 07

A one-sample t-test uses 30 observations. Which reference distribution gives its p-value?

3
Lec 07

Why does a test about a mean use a t-distribution instead of the standard normal?

4
Lec 07

A sample gives t=1.8t = 1.8 with 40 df. A student who planned Ha:μ<μ0H_a: \mu < \mu_0 computes the p-value. Which is closest?

5
Lec 07

Thirty drivers each complete a reaction-time task once while rested and once after a night shift. How should the shift effect on mean reaction time be tested?

6
Lec 07

Quantity A: the p-value from a two-sided t-test with μ^=102\hat\mu = 102, σ^=10\hat\sigma = 10, n=49n = 49, μ0=100\mu_0 = 100. Quantity B: the same test with σ^=20\hat\sigma = 20.

7
Lec 07

A city tests whether the mean response time of its ambulances differs from 12 minutes. Which conclusion fits the output?

t.test(minutes, mu = 12)

	One Sample t-test

data:  minutes
t = -0.84, df = 59, p-value = 0.4043
alternative hypothesis: true mean is not equal to 12

MaizePrep is an independent study resource. It is not affiliated with, sponsored by, or endorsed by the University of Michigan. Course names and numbers are used only to describe which class the material covers. Every practice question is original, written in the style of the course.