Data and statistics · cheat sheet

t-test

A test that compares averages: one average against a target (one-sample), two independent groups (two-sample), or the same items before and after (paired).

Common practice
5 steps
Used by Process Improvement Specialist

What it is

A t-test compares averages using the t distribution, which allows for the uncertainty of estimating the spread from a sample.

When to use it

With continuous data that is roughly normal, or samples large enough for the central limit theorem to help.

Why it works

It's the standard test for comparing averages of measured data.

Do

  • For paired data, test the differences with a one-sample t-test.
  • If spreads differ, use the unequal-variances version.

Don't

  • Using a two-sample test on paired data.
  • Ignoring very different spreads.
  • Small, very skewed samples.

Step by step

  1. Choose the version
  2. Check assumptions Normality, equal spreads.
  3. t = difference ÷ standard error
  4. p-value From t and degrees of freedom.
  5. Report Difference and interval.
Also called: One-sample, two-sample and paired t-testPrint the blank template ↗

Worked example

The situation. Two couriers' delivery times (days), 12 orders each.

  1. A: mean 3.08, s 0.47. B: mean 3.71, s 0.54. Levene p = 0.31, so spreads are similar.

The result. Courier A is faster by over half a day: the shop moved most orders to A.

t-test worksheet Print blank
PartValue
Difference0.63 days
t (pooled, 22 degrees of freedom)3.02
p-value0.006

Filled in for: Two couriers' delivery times (days), 12 orders each.

GroupnMeanStandard devia­tion

Copy this structure, or print the blank version and fill it in by hand. Version: one-sample / two-sample / paired · Equal spreads? · t = ______ · degrees of freedom = ______ · p = ______

Before you use it: check these

CheckIf it fails
Roughly normal data, or 30 or more per groupUse Mann-Whitney (two groups) or Wilcoxon (one group, or paired)
Independent groups (two-sample)If the same items are measured twice, use the paired t-test
Similar spreads, for the pooled versionUse the unequal-variances (Welch) version

How to do it with real data

The full calculation, as it happens in the story: the data, every step, how to read the result, and the spreadsheet functions to do it yourself.

Worked example with real data

Is the average wait really above 7 days?

From Day 28: Real, or just chance? of the Process Improvement Specialist story

Atticus (Sponsor) asks whether the wait could really be 7 days on average and the sample is just unlucky. Amara tests it.

Step by step

  1. HypothesesH0: the true mean is 7 days. H1: it is more than 7
  2. Choose the testcontinuous data, one group, compared with a value; 60 records, so averages are close to normal= one-sample t-test
  3. Test statistict = (mean − 7) ÷ (s ÷ √n) = (10.43 − 7) ÷ 0.834= 4.11
  4. p-valuechance of a mean this high if the truth were 7= 0.00006
  5. Decidep is below 0.05: reject H0
  6. Practical size3.4 days above the target matters to patients= statistically and practically significant
InputValue
Sample size60
Sample mean10.43 days
Standard deviation6.46 days
Value tested7 days
Significance level (alpha)0.05

How to read the result

A sample mean this far above 7 would almost never happen by chance if the real average were 7. The difference is also big enough to matter to patients.

What it led to

The gap to the target is real. The project moves on to finding which causes create it.

Do it in a spreadsheet

t statistic=(AVERAGE(B2:B61)-7)/(STDEV.S(B2:B61)/SQRT(60))
p-value (one-sided)=T.DIST.RT(D2,59)
Try it yourself: With a sample of 2,000 a test finds the mean wait is 7.1 days, p = 0.01, against a target of 7. Is it a problem worth a project?

It's statistically significant but practically tiny: 0.1 day. Large samples make small differences significant. Always ask whether the size of the difference matters.

Worked example with real data

Did something change at week 12?

From Day 30: What happened in week 12? of the Process Improvement Specialist story

The run chart showed a shift at week 12. The rota shows one doctor cut from five sessions a week to three that week, and the sessions were never covered. Astrid (Data Analyst) compares the weekly median waits before and after.

Weekly median waits before and after week 1205101520Before: median 8, quartiles 8 and 9, n = 118BeforeAfter: median 12, quartiles 11 and 12, n = 912After

Step by step

  1. Describe each groupbefore (11 weeks): mean 8.27, s 0.65 · after (9 weeks): mean 11.56, s 1.13
  2. Equal spreads? (F-test)F = 1.13² ÷ 0.65²; p = 0.10, and Levene's test p = 0.15= no evidence of different spreads
  3. Two-sample t-testt = (11.56 − 8.27) ÷ (0.895 × √(1/9 + 1/11))= 8.16
  4. p-value18 degrees of freedom= below 0.0001
  5. Check without assuming normal dataMann-Whitney: every week after is higher than every week before (U = 99 of 99)= p = 0.0001
  6. Size of the change11.56 − 8.27= about 3.3 days longer
WeekPeriodMedian wait (days)
Week 1Before8
Week 2Before9
Week 3Before8
Week 4Before7
Week 5Before9
Week 6Before8
Week 7Before9
Week 8Before8
Week 9Before8
Week 10Before9
Week 11Before8
Week 12After10
Week 13After10
Week 14After11
Week 15After11
Week 16After12
Week 17After12
Week 18After13
Week 19After12
Week 20After13

How to read the result

Since week 12 the weekly median wait is about 3.3 days longer, and it's very unlikely to be chance. The timing matches the lost doctor sessions.

What it led to

Root cause confirmed: about 30 routine appointments a week were lost at week 12 and never replaced.

Do it in a spreadsheet

F-test p-value=F.TEST(C2:C12,C13:C21)
t-test p-value (equal variances)=T.TEST(C2:C12,C13:C21,2,2)
Unequal variances version=T.TEST(C2:C12,C13:C21,2,3)
Mann-Whitneyrank all 20 values with RANK.AVG and add each group's ranks; no built-in p-value
Try it yourself: If the F-test had shown clearly different spreads, which version of the t-test would you use?

The unequal-variances version (often called Welch's t-test): =T.TEST(…,2,3). Here it also gives p below 0.0001.

In the roles

How a Process Improvement Specialist uses it

Weekly median waits before and after week 12: 8.27 and 11.56 days, t = 8.16, p below 0.0001.

Questions people ask

What's the spreadsheet function?

=T.TEST(range1, range2, tails, type): type 1 paired, 2 equal variances, 3 unequal.

Related techniques

← All techniques and tools