Lesson 3 · 30 min

Comparing results: t tests, F tests and outliers

Rayleigh’s two kinds of “nitrogen” differed by 0.5 %, and that difference led him to argon. Learn to decide whether a difference is real — and whether a suspect value may be rejected.

In this lesson

  • Use t tests to compare a mean with a reference value, two means with each other, and paired data
  • Compare the precision of two data sets with the F test and choose the pooled or Welch t test accordingly
  • Read p values and critical values, and say exactly what “significantly different” means
  • Judge a suspect value with the Grubbs test, and know when not to discard data

In 1894 Lord Rayleigh repeatedly weighed the “nitrogen” filling one glass globe. Nitrogen made by removing oxygen, water and carbon dioxide from air averaged 2.310 11 g; nitrogen made by decomposing nitrogen compounds averaged 2.299 47 g. The difference was only 0.5 %, and each set repeated well. Rayleigh did not write it off as experimental error; with William Ramsay he tracked it down to a heavier gas hiding in atmospheric “nitrogen” — argon. Today a statistical test answers the same question: is the difference real?

Predict first

The two sets have standard deviations of about 0.000 14 g and 0.001 4 g, and their means differ by 0.010 64 g. What do you conclude?

Pick an answer and lock it in before you look. A wrong guess teaches more than no guess.

Three kinds of t test

A statistical test starts from the null hypothesis: “the difference is due to random error alone”. You compute a test statistic; if it exceeds the critical value that it would reach only 5 % of the time under the null hypothesis, you reject the null hypothesis and call the difference “significant at the 95 % confidence level”. The p value is the probability of a difference at least this large if the null hypothesis were true.

  1. A mean against a known value: checking a method for systematic error with a reference material.
  2. Two means: two methods, two samples or two laboratories. First use an F test to see whether the variances agree: if they do, pool the standard deviations (ν = n₁ + n₂ − 2); if not, use Welch’s t test (effective degrees of freedom from the Welch–Satterthwaite formula).
  3. Paired data: several different samples, each measured once by both methods. A t test on each sample’s difference d cancels the real differences between the samples.
t=∣xˉ−μ0∣sn,t=∣xˉ1−xˉ2∣spn1n2n1+n2,sp=(n1−1)s12+(n2−1)s22n1+n2−2t = \frac{|\bar{x} - \mu_0|}{s}\sqrt{n},\qquad t = \frac{|\bar{x}_1 - \bar{x}_2|}{s_\mathrm{p}}\sqrt{\frac{n_1 n_2}{n_1 + n_2}},\qquad s_\mathrm{p} = \sqrt{\frac{(n_1-1)s_1^2 + (n_2-1)s_2^2}{n_1+n_2-2}}
If t exceeds the critical value for the chosen confidence level and degrees of freedom, the difference is significant.
μ0\mu_0
the known value (e.g. a certified reference value)
sps_\mathrm{p}
pooled standard deviation
n1, n2n_1,\ n_2
the number of results in each set

Worked example

Is the new method biased?

A coal reference material is certified to contain 3.19 wt % sulfur. A new method gives 3.29, 3.22, 3.30 and 3.23 wt %. At the 95 % confidence level, do its results differ significantly from the certified value?

The F test and outliers

F=s12s22 (s1>s2),G=∣xsuspect−xˉ∣sF = \frac{s_1^2}{s_2^2}\ (s_1 > s_2),\qquad G = \frac{|x_\text{suspect} - \bar{x}|}{s}
F above its critical value means the precisions differ; G above the Grubbs critical value (ISO 5725-2) marks the suspect value as an outlier.
FF
ratio of variances, the larger on top
GG
Grubbs statistic: how many s the suspect value lies from the mean
xˉ, s\bar{x},\ s
mean and standard deviation of all the data, suspect value included

Data sets often contain one result that “looks wrong”. Rejecting it needs grounds: first check the lab notes — a spill, a misreading, a bubble? If no cause turns up, use the Grubbs test: compute G and compare it with the critical value of ISO 5725-2 (or ASTM E178), which for n = 12 is 2.412 at 95 % and 2.636 at 99 %. It is better founded than the older Q (Dixon) test and is the one the international standards use. Test one suspect at a time, and the smaller the sample the more careful you must be: with 3–4 results almost any value “looks” suspicious.

G = |suspect − x̄| / s, compared with the ISO 5725-2 critical values

Keep or reject a suspect value? The Grubbs test

x̄ 46810121416Result / mg
G statistic
2.117
Critical (95 %) · n = 12
2.412
Critical (99 %)
2.636

Keep it: G is below the 95 % critical value — no grounds to reject

With the suspect x̄ = 10.16 mg, s = 1.11 mg

Without it x̄ = 10.37 mg, s = 0.87 mg

Eleven results are fixed and the twelfth can be dragged. G and the critical values are computed: G_crit = (n−1)/√n · √(t²/(n−2+t²)) with t the upper α/(2n) quantile of the t distribution (two-sided test), matching the 5 % and 1 % values of ISO 5725-2 Table 5 (2.412 and 2.636 for n = 12). Test one suspect at a time, and look for a cause in the lab record before rejecting anything.
Among twelve results 7.8 looks low, but its G is below the critical value, so it stays. Drag it to 6.5 and then 5.5 and see when G crosses the 95 % and 99 % lines — and how much the mean and s change when it is removed.

Concept check

You analyse six different soil samples once each by an old and a new method. Which test compares the two methods?

Try the calculation

Twelve results have a mean of 10.16 mg and a standard deviation of 1.11 mg; the lowest is 7.8 mg. What is its Grubbs statistic G?

Key takeaways

  • A t test asks whether a difference exceeds random error; p < 0.05 means significant at the 95 % level.
  • Before comparing two means, run an F test: pool if the variances agree, use Welch if not; for the same samples measured twice, use a paired t test.
  • For a suspect value look for a cause first, then apply the Grubbs test (ISO 5725-2), one value at a time.
  • “Not significant” is not “the same”, and “significant” is not “important”.
Progress is stored only in this browser and never uploaded.

Data and references

  1. Lord Rayleigh, “On an anomaly encountered in determinations of the density of nitrogen gas”, Proceedings of the Royal Society of London 55, 340–344 (1894); data as quoted in D. C. Harris, Quantitative Chemical Analysis, 9th ed. (2016), chapter 4.
  2. D. C. Harris, Quantitative Chemical Analysis, 9th ed., W. H. Freeman (2016), chapter 4 (t tests, F test, Grubbs test).
  3. ISO 5725-2:2019, Accuracy (trueness and precision) of measurement methods and results — Part 2, Table 5 (critical values for Grubbs’ test).
  4. ASTM E178-16a, Standard Practice for Dealing With Outlying Observations.
  5. B. L. Welch, “The generalization of ‘Student’s’ problem when several different population variances are involved”, Biometrika 34, 28–35 (1947).