Back to Clinical trial Lab
STATISTICS / INTERACTIVE LAB

Compare two groups: t test

Change values in both groups and see how the mean difference, within-group variability and sample size affect the P value.

t

Enter two groups

01 / DATA

Enter independent observations separated by commas, spaces or line breaks; up to 500 per group.

Try an example

These illustrative examples are not real patient data.

0

The slider adds the same amount to every value in group B; the input retains the original values.

Two-sided P value0.7201Welch two-sided test · α = 0.05
RESULT / 02Not statistically significant at α = 0.05Mean difference (A − B): -0.6
03 / DISTRIBUTION

Compare the distributions

n = 10 / 10

Curves are smoothed sample density estimates; dashed lines show group means.

Group A · Mean 50Group B · Mean 50.6
36.7143.365056.6463.29

Each dot represents one observation. Value →

Group A · Sample size10Sample standard deviation: 3.94
Group B · Sample size10Sample standard deviation: 3.41
Mean difference (A − B)-0.6Degrees of freedom: 17.63
95% CI for mean difference-4.07 – 2.87
i

How should we interpret this?

When sample means are close and distributions overlap, the P value may be large. Small samples or large within-group variability can also produce a non-significant result; it does not prove the populations are identical or equivalent.

The P value is the probability of results at least as extreme as these under equal population means and the test assumptions; it is not the probability that the groups are equal.

Independent-samples, two-sided Welch t test (equal variances are not required). Observations should be independent; small samples with severe skew or outliers can make the result unreliable.

For education; not a substitute for a complete statistical analysis.

NIST: two-sample t test ↗