Topic contents

Lesson 7

t-tests for a population mean

How do we test using the sample standard deviation when the population standard deviation is unknown?

Test settings

Try it

Click to explore each case

Testing a population mean: first check whether the population standard deviation is known

As with confidence intervals, the first step is to check whether the population variance is known, along with the sample size and distributional conditions, before applying a formula.

CaseStatistic usedCoverage in this lesson
Population variance knownZ (using σ)Covered in the previous lesson
Population variance unknown, large sampleUsually t; a Z approximation is possible with independent sampling, finite variance, a reliable normal approximation, and other required conditionsWe can use t in this lesson
Population variance unknown, small samplet (using s)Main focus of this lesson
This lesson focuses on an unknown population standard deviation σ, requiring the sample standard deviation s to estimate the standard error (SE). For an independent random sample from a normal population, the statistic has a t distribution with n−1 degrees of freedom.
Known population standard deviation σ: calculate the standard error as σ/√n. Use the Z statistic when the normal-distribution or large-sample approximation conditions hold.
Z=xˉ−μ0σ/nZ=\frac{\bar x-\mu_0}{\sigma/\sqrt n}
Conditions for a large-sample Z approximation: sample observations are independent (or sufficiently weakly dependent with appropriate theoretical justification), the population variance is finite, and the sample is large enough for the sample mean to be approximately normal and for s to estimate σ fairly stably. Marked skewness or extreme values may require a larger sample. n≥30 is a common rule of thumb, not a universal guarantee. When the population standard deviation is unknown, a t-test is also appropriate for large samples.

Test settings

Try it

Why a t distribution rather than the standard normal distribution?

When σ is unknown, we calculate the standard error with the sample standard deviation s. Because s also comes from the sample, it introduces additional uncertainty. With small samples, the t distribution therefore usually has heavier tails than the standard normal distribution.

−4−2024
  • Standard normal distribution
  • t distribution
Solid curve: standard normal distribution; dashed curve: t distribution. Drag the degrees of freedom slider to compare how the curves change.
df=n−1df=n-1
Corresponding sample size
10
Two-sided 5% t critical value
2.262
Two-sided 5% Z critical value
1.960
As the degrees of freedom increase, the t distribution begins to approach the standard normal distribution.
For an independent random sample from a normal population, the statistic constructed with the sample standard deviation follows t(n−1) exactly. Use caution when the distribution departs from normality, especially with small samples.

Test settings

Try it

Choose an example

The sample mean slider changes only the sample mean. The sample size and standard deviation are held fixed so you can see how t changes with the data.

Write the original formula, then substitute the sample data

Consider battery life: the researcher asks whether the population mean life exceeds 10 hours. The population standard deviation is unknown. A random sample of 25 batteries from an approximately normal population gives a sample standard deviation s=1.5 hours.

Does mean battery life exceed 10 hours?

H₀: μ ≤ 10

H₁: μ > 10

μ₀ = 10 h, s = 1.5 h, n = 25; population standard deviation unknown

t=xˉ−μ0s/nt=\frac{\bar x-\mu_0}{s/\sqrt n}

Original formula: difference between the sample mean and hypothesized value ÷ standard error of the sample mean

How do we substitute the actual values?

  1. Standard error of the sample mean
    SE=sn=1.525=0.3000 hSE=\frac{s}{\sqrt n}=\frac{1.5}{\sqrt{25}}=0.3000\ \text{h}
  2. Numerical substitution
    t=10.60−101.5/25≈0.60000.3000≈2.000t=\frac{10.60-10}{1.5/\sqrt{25}}\approx\frac{0.6000}{0.3000}\approx 2.000
  3. Obtain the statistic and degrees of freedom
    t=2.000,df=25−1=24t=2.000,\quad df=25-1=24
The sample mean differs from the reference value by 0.6000 h, equivalent to 2.00 times the standard error of the sample mean.

The sample mean slider changes only the sample mean. The sample size and standard deviation are held fixed so you can see how t changes with the data.

Test settings

Try it

Choose an example
Significance level α

The sample mean slider changes only the sample mean. The sample size and standard deviation are held fixed so you can see how t changes with the data.

What is the p-value for the sample result?

All three examples and their full hypotheses are retained. Switch examples, drag the sample mean, or choose α to check that the t value, tail area, and statistical conclusion agree.

H₀: μ ≤ 10

H₁: μ > 10

−4−3−2−101234t1.711t = 2.000
  • t distribution
  • Sample t position
  • Critical value
  • Tail area corresponding to the p-value
The hatched area is the p-value, the blue vertical lines are the corresponding critical values, and the dotted line marks this sample's t value.
Statistic t
2.000
p-value (from the t distribution)
0.02847
Significance level α
0.05
Critical value
1.711

0.02847 ≤ 0.05. Decision: Reject H₀. The sample evidence meets the prespecified significance threshold.

With the population standard deviation unknown, we calculate the p-value from a t distribution with df=n−1, rather than substituting a standard normal tail area.

Test settings

Try it

Choose an example
Significance level α

The sample mean slider changes only the sample mean. The sample size and standard deviation are held fixed so you can see how t changes with the data.

A complete hypothesis test: from research question to test conclusion

First choose a research question, then adjust the sample data and significance level to see how the critical-value and p-value methods reach the same decision.

H₀: μ ≤ 10

H₁: μ > 10

−4−3−2−101234t1.711t = 2.000
  • t distribution
  • Sample t position
  • Critical value
  • Tail area corresponding to the p-value
The hatched area is the p-value, the blue vertical lines are the corresponding critical values, and the dotted line marks this sample's t value.
Statistic t
2.000
p-value (from the t distribution)
0.02847
Significance level α
0.05
Critical value
1.711
  1. Ask the question and state the hypotheses
    Does mean battery life exceed 10 hours?

    H₀: μ ≤ 10

    H₁: μ > 10

  2. Calculate the statistic (formula, then substitution)
    t=xˉ−μ0s/n=10.60−101.5/25≈0.60000.3000≈2.000,df=25−1=24t=\frac{\bar x-\mu_0}{s/\sqrt n}=\frac{10.60-10}{1.5/\sqrt{25}}\approx\frac{0.6000}{0.3000}\approx 2.000,\quad df=25-1=24
  3. Critical-value method
    α=0.05, critical value 1.711; t=2.000, in the rejection region.
  4. p-value method
    0.02847 ≤ 0.05. Decision: Reject H₀. The sample evidence meets the prespecified significance threshold.
  5. Conclusion: Reject H₀. The sample result supports the direction of difference specified by the alternative hypothesis (it reaches statistical significance).

Test settings

Variance known