Calculate the difference between two means, or run a two-sample or paired t-test with confidence interval, p-value, and effect size.

Use the same measurement scale for both means.


Related Calculators

Calculator Functions

FunctionWhat it doesWhat it requires
Mean 1 โˆ’ Mean 2Finds the signed difference between two meansRequires Mean 1 and Mean 2 on the same measurement scale
Mean 1Finds the first mean from the second mean and the differenceRequires Mean 2 and the difference
Mean 2Finds the second mean from the first mean and the differenceRequires Mean 1 and the difference
Check supplied differenceCompares a stated difference with Mean 1 โˆ’ Mean 2Requires Mean 1, Mean 2 and the difference to check
Independent samples t-testTests whether two independent groups have the same mean, with a confidence interval and effect sizesRequires the mean, sample standard deviation and sample size of each group, the t-test method and the confidence level
Paired differences t-testTests whether the mean of paired differences is zero, with a confidence interval and effect sizeRequires the mean difference, the sample standard deviation of the differences, the number of pairs and the confidence level

The t-test method is Welch for unequal variances or pooled for equal variances, and the confidence level is 90%, 95% or 99%. Both tests are two-sided and need at least two observations per group or two pairs.

Difference Of Means Formulas

D = M1 โˆ’ M2
DDifference of means
M1Mean of the first group
M2Mean of the second group

Mean 1 โˆ’ Mean 2

The main formula applies directly. Means of 10 and 7 differ by 10 โˆ’ 7 = 3. The sign shows which group is higher.

Mean 1

M1 = M2 + D

A second mean of 7 and a difference of 3 put the first mean at 10.

Mean 2

M2 = M1 โˆ’ D

A first mean of 10 and a difference of 3 put the second mean at 7.

Check supplied difference

The calculator works out M1 โˆ’ M2 and reports how far the stated difference is from it. For means of 10 and 7 and a stated difference of 2.5, the true difference is 3 and the stated value is off by โˆ’0.5.

Independent samples t-test

t = D รท
โˆš(s1ยฒ รท n1 + s2ยฒ รท n2) [1]
ฮฝ = (a + b)ยฒ รท
(aยฒ รท (n1 โˆ’ 1) +
bยฒ รท (n2 โˆ’ 1)) [1]

This is the Welch test. s is each sample standard deviation, n is each sample size, a = s1ยฒ รท n1, b = s2ยฒ รท n2, and ฮฝ is the degrees of freedom [1]. The square root is the standard error SE, and the confidence interval is D ยฑ t* ร— SE, with t* taken from the t distribution for ฮฝ.

spยฒ = ((n1 โˆ’ 1)s1ยฒ +
(n2 โˆ’ 1)s2ยฒ) รท (n1 + n2 โˆ’ 2) [1]

The pooled method combines the two variances into spยฒ, then uses SE = sp ร— โˆš(1 รท n1 + 1 รท n2) and ฮฝ = n1 + n2 โˆ’ 2 [1]. It assumes both groups have the same variance, which should be tested before it is assumed [2].

g = (D รท sp) ร—
(1 โˆ’ 3 รท (4ฮฝ โˆ’ 1)) [4]

Cohen's d is D รท sp, and Hedges' g applies a small-sample correction with ฮฝ = n1 + n2 โˆ’ 2 [4]. For means of 59.12 and 54.34, standard deviations of 12.32 and 11.57 and sample sizes of 39 and 41, D = 4.78, sp = 11.94 and g = 0.40 [4]. The Welch test on the same data gives SE = 2.6752, t = 1.787 and ฮฝ = 77.0.

Paired differences t-test

t = D รท (sd รท โˆšn) [3]

D is the mean of the pairwise differences, sd is their sample standard deviation, n is the number of pairs and ฮฝ = n โˆ’ 1 [3]. A mean difference of 2.5 with sd = 4 across 16 pairs gives SE = 1, t = 2.5 and ฮฝ = 15. The effect size dz is D รท sd = 0.625.

What Is the Mean Difference?

The mean difference is one group's average minus another's, in the units of the measurement. A positive value means the first group averages higher. On its own it does not show whether the gap is larger than chance would produce. That takes a t-test, which weighs the difference against the spread and the size of each sample.

Limits of This Estimate

  • Both tests assume independent observations, or independent pairs, and sample means that are approximately normal.
  • Paired data needs the paired test. Running the independent test on paired measurements ignores the one-to-one link between the samples [1].
  • A small p-value shows a difference unlikely to be chance. It does not show that the difference is large enough to matter, or what caused it.
  • When every standard deviation is zero, the standard error is zero and the test and interval have no value.

Sources

  1. NIST/SEMATECH e-Handbook of Statistical Methods, Section 1.3.5.3, Two-Sample t-Test for Equal Means: test statistic, Welch-Satterthwaite degrees of freedom, pooled variance and paired versus unpaired data
  2. NIST/SEMATECH e-Handbook of Statistical Methods, Section 7.3.1, Do two processes have the same mean?: testing the equal-variance assumption before pooling
  3. NIST/SEMATECH e-Handbook of Statistical Methods, Section 7.3.1.1, Analysis of paired observations: paired t statistic and its degrees of freedom
  4. U.S. Department of Education, What Works Clearinghouse Procedures and Standards Handbook, Version 5.0, Appendix E: Hedges' g, the pooled standard deviation, the small-sample correction and the worked example