# t-tests and confidence intervals for means

> IB Mathematics: Applications and Interpretation HL · Unit 5: Statistics and probability
> Source: https://www.owlsprep.com/study/ib-math-ai-hl-u5-t-tests-and-confidence-intervals/

This sub-topic covers t-procedures for inference about population means when the population standard deviation is unknown, the most common scenario in IB exams. You will learn hypothesis testing and interval estimation for one and two samples.

**Prerequisites:** [Inferential statistics fundamentals](https://www.owlsprep.com/study/ib-math-ai-hl-u5-inferential-statistics-intro/); [Hypothesis testing basics](https://www.owlsprep.com/study/ib-math-ai-hl-u5-hypothesis-testing-basics/); [z-procedures for confidence intervals](https://www.owlsprep.com/study/ib-math-ai-hl-u5-z-confidence-intervals/)

## Learning objectives

- Identify when to use t-procedures instead of z-procedures for inference about means
- Calculate and interpret confidence intervals for an unknown population mean
- Conduct one-sample, paired, and independent two-sample t-tests for population means
- Interpret results of t-procedures correctly in context for exam questions
- Carry out a one-tailed test for a proportion using the binomial distribution and for a population mean using the Poisson distribution

## The t-distribution and when to use t-procedures

When performing inference for a population mean $\mu$, z-procedures are only valid if we know the true population standard deviation $\sigma$. In almost all real research and IB exam problems, $\sigma$ is unknown, so we use the t-distribution instead of the standard normal (z) distribution.

**Student's t-distribution** — A symmetric, bell-shaped distribution that accounts for additional uncertainty from estimating $\sigma$ with the sample standard deviation $s$. It has heavier tails than the z-distribution to avoid underestimating p-values and margin of error.

*Notation:* $t \sim t(df)$

*Example:* A sample of size 10 has $df = 9$ degrees of freedom for a one-sample t-procedure.

> **info**
>
> For IB Mathematics AI HL, degrees of freedom are calculated as: $df = n-1$ for one-sample and paired t-tests, and $df = \min(n_1-1, n_2-1)$ for unpaired independent two-sample t-tests.

**Check your understanding**

Check your understanding of when to use t-procedures:

1. You know the true population standard deviation $\sigma$, should you use a t-test or z-test?

   - t-test
   - z-test

   *Answer:* z-test

   *Why:* Correct! Z-tests are appropriate when $\sigma$ is known.

2. $\sigma$ is unknown, you only have the sample standard deviation $s$, should you use a t-test or z-test?

   - t-test
   - z-test

   *Answer:* t-test

   *Why:* Correct! This is the most common scenario in IB exams.

## One-sample t-test and confidence interval for $\mu$

**One-sample t-test** — A hypothesis test for the value of a single unknown population mean, used when the population standard deviation is unknown.

*Example:* Testing whether the average weight of a cereal box is different from the advertised 500g.

**Worked example:** A botanist measures the heights of 10 young oak trees, getting a sample mean of 12.3m and sample standard deviation of 1.8m. Test at 5% significance whether the true mean height is different from 12m.

1. State the null and alternative hypotheses:
2. $$H_0: \mu = 12, \quad H_1: \mu \neq 12$$
3. Calculate degrees of freedom and test statistic: $df = n-1 = 10-1 = 9$. The test statistic formula is:
4. $$t = \frac{\bar{x} - \mu_0}{s/\sqrt{n}}$$
5. Substitute the sample values:
6. $$t = \frac{12.3 - 12}{1.8/\sqrt{10}} \approx 0.527$$
7. Find the two-tailed p-value for $t=0.527$, $df=9$: $p \approx 0.612$
8. Conclude: Since $0.612 > 0.05$, we fail to reject $H_0$. There is insufficient evidence at 5% significance that the true mean height differs from 12m.

**Worked example:** Calculate a 95% confidence interval for the true mean height of the oak trees from the sample above.

1. The formula for a $(1-\alpha)$ confidence interval for $\mu$ when $\sigma$ is unknown is:
2. $$\bar{x} \pm t^* \frac{s}{\sqrt{n}}$$
3. Where $t^*$ is the critical t-value for the given confidence level and $df$. For 95% confidence, $df=9$, $t^* \approx 2.262$.
4. Calculate the margin of error:
5. $$ME = 2.262 \times \frac{1.8}{\sqrt{10}} \approx 1.29$$
6. Construct the interval: $(12.3 - 1.29, 12.3 + 1.29)$
7. $$(11.01, 13.59)$$
8. Interpretation: We are 95% confident that the true mean height of the oak trees lies between 11.01m and 13.59m.

## Paired t-tests for matched data

**Paired t-test** — A hypothesis test for the mean difference in dependent paired data, such as before/after measurements on the same subjects, or matched pairs of individuals. We reduce paired data to a single sample of differences and perform a one-sample t-test on the differences.

*Example:* Testing whether a new allergy medication reduces average symptom score.

**Worked example:** 8 participants had their resting heart rate measured before and after a 4-week walking program. The mean difference (before $-$ after) is 3.2 bpm, with a sample standard deviation of differences of 2.8 bpm. Test at 10% significance whether the program reduces mean resting heart rate.

1. Let $\mu_d$ be the true mean difference (before $-$ after). State hypotheses:
2. $$H_0: \mu_d = 0, \quad H_1: \mu_d > 0$$
3. Degrees of freedom: $df = n-1 = 8-1 = 7$
4. Calculate test statistic:
5. $$t = \frac{\bar{d} - 0}{s_d/\sqrt{n}} = \frac{3.2}{2.8/\sqrt{8}} \approx 3.23$$
6. Find the one-tailed p-value for $t=3.23$, $df=7$: $p \approx 0.0087$
7. Conclude: Since $0.0087 < 0.10$, we reject $H_0$. There is sufficient evidence at 10% significance that the walking program reduces mean resting heart rate.

> **exam_tip**
>
> Always frame your hypotheses in terms of the mean difference $\mu_d$, not separate means for each group, for paired tests.

## Independent two-sample t-tests for difference in means

**Independent two-sample t-test** — A hypothesis test for the difference between the means of two independent populations, when both population standard deviations are unknown.

*Example:* Comparing the average exam scores of students taught with two different teaching methods.

**Worked example:** A teacher compares test scores of 15 students from Class A ($\bar{x}_A = 72$, $s_A = 8$) and 12 students from Class B ($\bar{x}_B = 76$, $s_B = 7$). Test at 5% significance whether the true mean score of Class B is higher than Class A.

1. State hypotheses, where $\mu_A$ = true mean score for Class A, $\mu_B$ = true mean score for Class B:
2. $$H_0: \mu_B - \mu_A = 0, \quad H_1: \mu_B - \mu_A > 0$$
3. For IB AI HL, degrees of freedom is the minimum of $(n_1-1, n_2-1)$: $df = \min(14, 11) = 11$
4. Test statistic formula for difference in means:
5. $$t = \frac{(\bar{x}_B - \bar{x}_A) - 0}{\sqrt{\frac{s_A^2}{n_A} + \frac{s_B^2}{n_B}}}$$
6. Substitute values:
7. $$t = \frac{(76 - 72)}{\sqrt{\frac{8^2}{15} + \frac{7^2}{12}}} \approx 1.395$$
8. One-tailed p-value for $t=1.395$, $df=11$: $p \approx 0.097$
9. Conclude: Since $0.097 > 0.05$, we fail to reject $H_0$. There is insufficient evidence at 5% significance that Class B has a higher true mean score.

## Tests for a proportion (binomial) and a Poisson mean (AHL)

Not every hypothesis test concerns the mean of continuous data. When the data are counts, IB AI HL requires you to test directly from the underlying discrete distribution — the binomial for a proportion, and the Poisson for a mean rate — using exact tail probabilities from your GDC rather than a normal approximation.

**Test for a proportion using the binomial distribution** — A hypothesis test on an unknown proportion p. Under $H_0: p = p_0$, the number of successes X in n independent trials follows $X \sim B(n, p_0)$. The one-tailed p-value is the exact binomial tail probability of a result at least as extreme as the observed count.

*Example:* Testing whether the true proportion of on-time deliveries is below an advertised 90%.

**Worked example:** A courier advertises that 90% of parcels arrive on time. A consumer group suspects the true proportion is lower. In a random sample of 20 parcels, 15 arrive on time. Test at the 5% significance level.

1. State hypotheses for the proportion $p$ of on-time parcels:
2. $$H_0: p = 0.9, \quad H_1: p < 0.9$$
3. Under $H_0$, the count of on-time parcels is $X \sim B(20, 0.9)$. The observed value is $x = 15$, and small values count against $H_0$, so use the lower tail.
4. Calculate the lower-tail p-value on the GDC using the binomial cdf:
5. $$p\text{-value} = P(X \le 15) \approx 0.0432$$
6. Since $0.0432 < 0.05$, reject $H_0$. There is sufficient evidence at the 5% level that fewer than 90% of parcels arrive on time.

**Test for a population mean using the Poisson distribution** — A hypothesis test on the mean m of a Poisson process. Under $H_0: m = m_0$, an observed count X over the same interval follows $X \sim Po(m_0)$. The one-tailed p-value is the exact Poisson tail probability in the direction of $H_1$.

*Example:* Testing whether the mean number of calls per hour to a helpline has increased after a campaign.

**Worked example:** Calls to a helpline historically follow a Poisson distribution with a mean of 12 per hour. After a publicity campaign, staff believe the mean rate has increased. In one randomly chosen hour, 19 calls are received. Test at the 5% significance level.

1. State hypotheses for the Poisson mean $m$ (calls per hour):
2. $$H_0: m = 12, \quad H_1: m > 12$$
3. Under $H_0$, $X \sim Po(12)$. The observed value is $x = 19$; large values count against $H_0$, so use the upper tail.
4. Calculate the upper-tail p-value on the GDC:
5. $$p\text{-value} = P(X \ge 19) = 1 - P(X \le 18) \approx 0.0374$$
6. Since $0.0374 < 0.05$, reject $H_0$. There is sufficient evidence at the 5% level that the mean call rate has increased.

> **exam_tip**
>
> These are exact tests: read the tail probability straight from the binomial or Poisson cdf on your GDC — do not use a t- or z-approximation. Decide the tail from $H_1$, and recall that $P(X \ge x) = 1 - P(X \le x-1)$.

## Common pitfalls

- **Wrong:** Using a z-test instead of t-test when $\sigma$ is unknown
  - Why it fails: The z-distribution does not account for extra uncertainty from estimating $\sigma$ with $s$, leading to p-values that are too small
  - Correct: Always use t-procedures for means when $\sigma$ is unknown, which is almost always the case in IB exams
- **Wrong:** Using an unpaired t-test for paired dependent data
  - Why it fails: Unpaired tests ignore the matching in paired data, wasting information and leading to incorrect p-values
  - Correct: Calculate differences for each pair and run a one-sample t-test on the sample of differences
- **Wrong:** Interpreting a 95% confidence interval as 'there is a 95% probability the true mean is in this interval'
  - Why it fails: The true mean is a fixed constant, not random: it is either inside or outside the interval. 95% refers to the method of constructing intervals
  - Correct: Interpret as 'We are 95% confident that the true mean lies between the lower and upper bound'
- **Wrong:** Using $df = n_1 + n_2 - 2$ for unpaired t-tests in IB AI HL
  - Why it fails: IB AI HL requires the conservative estimate of $df = \min(n_1-1, n_2-1)$ for unpaired two-sample t-tests
  - Correct: Always take the smaller of $(n_1-1, n_2-1)$ to get the correct degrees of freedom for exam grading
- **Wrong:** Forgetting to state the conclusion in context
  - Why it fails: Most IB exam questions require a contextual conclusion to get full marks for hypothesis test questions
  - Correct: Always link your conclusion back to the original problem scenario after deciding to reject or fail to reject $H_0$

## Cheatsheet

| Procedure | Degrees of Freedom | Test Statistic |
| --- | --- | --- |
| One-sample t-test | $n-1$ | $t = \frac{\bar{x} - \mu_0}{s/\sqrt{n}}$ |
| Paired t-test | $n-1$ ($n$ = number of pairs) | $t = \frac{\bar{d}}{s_d/\sqrt{n}}$ |
| Independent t-test | $\min(n_1-1, n_2-1)$ | $t = \frac{\bar{x}_2 - \bar{x}_1}{\sqrt{\frac{s_1^2}{n_1} + \frac{s_2^2}{n_2}}}$ |
| $(1-\alpha)$ CI for $\mu$ | $n-1$ | $\bar{x} \pm t^* \frac{s}{\sqrt{n}}$ |

## What's next

t-tests and confidence intervals for means are core inferential tools that form the foundation for almost all parametric statistics used in research, business, and the social sciences. Mastery of these procedures is essential for high marks on the IB AI HL exam, and will prepare you for university-level statistics courses regardless of your field of study. Next, you will apply t-procedures to inference for linear regression parameters, where we test whether the slope of a regression line is significantly different from zero. You will also learn about chi-square tests for categorical data and non-parametric alternatives for when the normality assumption of t-procedures is violated.

- [Spearman's rank correlation coefficient](https://www.owlsprep.com/study/ib-math-ai-hl-u5-spearman-s-rank-correlation-coefficient/)
- [Graph theory: basic concepts](https://www.owlsprep.com/study/ib-math-ai-hl-u5-graph-theory-basic-concepts/)
- [Graph theory: adjacency matrices, paths and cycles](https://www.owlsprep.com/study/ib-math-ai-hl-u5-graph-theory-adjacency-matrices-paths/)

---

From [OwlsPrep](https://www.owlsprep.com) — free study guides for A-Level, IB, AP and IGCSE, written against the official syllabus. Canonical page: https://www.owlsprep.com/study/ib-math-ai-hl-u5-t-tests-and-confidence-intervals/
