Skip to main content
Mail a PDF copy of this page to:
(Your email address will not be added to a mailing list)
Download our user-friendly MedCalc statistical software for your Windows desktop. Download

Other calculators ...

Free statistical calculators

Comparison of means calculator

Sample 1

Sample 2


This procedure calculates the difference between the observed means in two independent samples. A significance value (P-value) and 95% Confidence Interval (CI) of the difference is reported. The P-value is the probability of obtaining the observed difference between the samples if the null hypothesis were true. The null hypothesis is the hypothesis that the difference is 0.

Required input

For both samples, you enter:

  • Mean: the observed arithmetic mean.
  • Standard deviation: the observed standard deviation.
  • Sample size: the number of observations in the sample.

Computational notes

The program first calculates the pooled standard deviation s:

Comparison of means: pooled standard deviation$$ s = \sqrt { \frac { (n_1-1) s_1^2 + (n_2-1) s_2^2 } { n_1+n_2-2 } } $$

where s1 and s2 are the standard deviations of the two samples with sample sizes n1 and n2.

The standard error se of the difference between the two means is calculated as:

Comparison of means: standard error of the difference between two means$$ se(\bar{x_1} - \bar{x_2}) = s \times \sqrt{ \frac{1}{n_1} + \frac{1}{n_2} } $$

The significance level, or P-value, is calculated using the t-test, with the value t calculated as:

Comparison of means: t-value$$ t = \frac {\bar{x_1} - \bar{x_2}} { se(\bar{x_1} - \bar{x_2}) } $$

The P-value is the area of the t distribution with n1 + n2 − 2 degrees of freedom, that falls outside ± t (see Values of the t distribution table).

When the P-value is less than 0.05 (P<0.05), the conclusion is that the two means are significantly different. Note that in MedCalc P-values are always two-sided (or two-tailed).


  • Altman DG (1991) Practical statistics for medical research. London: Chapman and Hall.
  • Kirkwood BR, Sterne JAC (2003) Essential medical statistics, 2nd ed. Oxford: Blackwell Science.

How to cite this page

  • MedCalc Software Ltd. Comparison of means calculator. (Version 22.026; accessed June 24, 2024)

See also