One sample: t = (x̄ − μ₀) / (s/√n) df = n − 1
Two samples: t = (x̄₁ − x̄₂) / √(s₁²/n₁ + s₂²/n₂) Welch, df ≈ messy
Paired: t = d̄ / (s_d/√n) on the differences dᵢ = xᵢ − yᵢ
Counts: χ² = Σ (observed − expected)² / expected
Check 1 — not significant. A sensor claims mean 100. You measure x̄ = 103 on n = 16 readings with s = 8:
t = (103 − 100) / (8/√16) = 3 / 2 = 1.50
|t| = 1.50 is inside the |t| ≈ 2 “p < 0.05” zone, so not significant.
Two-sided p ≈ 0.15 — data this far off happens 15% of the time
by luck alone.
Check 2 — same gap, different noise. Two models on 100 examples each, both with s = 0.05, means 0.87 and 0.89:
t = (0.89 − 0.87) / √(0.05²/100 + 0.05²/100)
= 0.02 / 0.00707 ≈ 2.83 → p ≈ 0.005 significant
The 0.02 gap from the opening story is not inherently “noise” or
“real” — it depends on the noise in the measurement. Smaller
variance or more examples can turn the same gap significant.
Counts, for completeness. A model produces 120 positive and 80 negative outputs where 100/100 was expected: χ² = 20²/100 + 20²/100 = 8 with 1 degree of freedom, so p < 0.005 — the output distribution is not what was expected.
The permutation flavour (what the lab runs) skips the formula: pool the two groups, shuffle the labels 2,000 times, and count how often the difference is at least as extreme.
observed difference = 4.2
37 of 2,000 shuffles are at least that extreme
p ≈ (37 + 1)/(2,000 + 1) ≈ 0.019
“If there were no effect, a gap this large would appear about
2% of the time.” That is the p-value, said in plain English.