Statistics & graphs · SL/HL

Two-sample t-test

Compare independent or paired samples with a t-test.

Your values

Number formats & units

Use decimal dots in datasets. Single values also accept decimal commas and scientific notation such as 1.2e-3 or 1.2 × 10⁻³.

Two-Sample t-Test Calculator inputs

Calculated locally. No account or input upload.

Result & working

Example

The calculator is loading. The worked example is also shown below.

Copy & export

Formula & example

The relationship

Welch:t=xˉ1−xˉ2s12/n1+s22/n2\text{Welch:}\quad t=\frac{\bar x_1-\bar x_2}{\sqrt{s_1^2/n_1+s_2^2/n_2}}
paired:t=dˉsd/n\text{paired:}\quad t=\frac{\bar d}{s_d/\sqrt n}
What the variables mean
SymbolMeaning
ppTwo-tailed probability under the null model.
df\mathrm{df}Degrees of freedom.

Worked example

Test type
Independent samples (Welch)
Sample A
12.1 11.8 12.4 12.0 11.9
Sample B
13.0 12.8 13.4 12.9 13.2

t = -6.845792, p = 0.0001328

Follow the example steps
  1. x̄₁ = 12.04, s₁ = 0.2302173, n₁ = 5
  2. x̄₂ = 13.06, s₂ = 0.2408319, n₂ = 5
  3. t = (x̄₁−x̄₂)/√(s₁²/n₁+s₂²/n₂) = -6.845792
  4. Welch degrees of freedom ≈ 7.9838
  5. Two-tailed p ≈ 0.0001328.

Common mistakes

Use a paired test only for meaningfully matched observations.

Incorrect approach

Before 5, 10; after 6, 12 for the same two individuals: ignore the matching.

Correct approach

Analyse the paired changes 1, 2.

More checks before you submit
  • Use paired analysis only when observations are meaningfully matched.
  • Statistical significance is not the same as biological importance.
Method notes

Choose the test design before looking at the outcome. A statistical test does not repair poor sampling, lack of independence or confounding.