# What does my t-test show?

Runs a one-sample, two-sample (Welch or pooled), or paired t-test from means, standard deviations, and sample sizes, with the t statistic, degrees of freedom, p-value, and decision.

- Page: https://www.acalculator.org/statistics/t-test-calculator
- JSON spec: https://www.acalculator.org/statistics/t-test-calculator.json
- Version: 6381cf841cf1

## Default answer

Example with the default inputs (Test Two-sample, Mean (x̄₁) 75, Standard deviation (s₁) 10, Sample size (n₁) 30, Mean (x̄₂) 70, Standard deviation (s₂) 12, Sample size (n₂) 35, Variances Unequal (Welch), Hypothesized value (μ₀) 0, Alternative hypothesis Two-tailed (≠), Significance level (α) 0.05): t = 1.832151 with 62.95882 degrees of freedom and a p-value of 0.071659. Do not reject the null hypothesis at α = 0.05.

## Inputs

| Key | Label | Description |
| --- | --- | --- |
| type | Test | One-sample compares a mean with a value; two-sample compares two independent groups; paired compares two measurements on the same subjects. |
| m1 | Mean (x̄₁) | The sample mean, or the mean of group 1 for a two-sample test. |
| s1 | Standard deviation (s₁) | The sample standard deviation of the sample or of group 1. |
| n1 | Sample size (n₁) | How many observations are in the sample or in group 1, at least 2. |
| m2 | Mean (x̄₂) | The sample mean of group 2. |
| s2 | Standard deviation (s₂) | The sample standard deviation of group 2. |
| n2 | Sample size (n₂) | How many observations are in group 2, at least 2. |
| dm | Mean of the differences (d̄) | The mean of the paired differences (after − before, or first − second). |
| ds | SD of the differences (s(d)) | The sample standard deviation of the paired differences. |
| np | Number of pairs (n) | How many pairs there are, at least 2. |
| var | Variances | Welch’s test does not assume equal variances; the pooled test assumes the two groups have the same variance. |
| mu0 | Hypothesized value (μ₀) | The mean under the null hypothesis (one-sample), or the difference μ₁ − μ₂ or mean difference under the null hypothesis, usually 0. |
| tail | Alternative hypothesis | Two-tailed tests for any difference; left- and right-tailed test for a difference in one direction. |
| alpha | Significance level (α) | The cut-off for the p-value, for example 0.05. |

## Outputs

| Key | Label | Description |
| --- | --- | --- |
| t | t statistic | The estimate minus the hypothesized value, divided by its standard error. |
| df | Degrees of freedom | n − 1 (one-sample, paired), n₁ + n₂ − 2 (pooled), or the Welch–Satterthwaite value (Welch). |
| pValue | P-value | The chance of a t statistic at least this extreme, in the chosen direction, if the null hypothesis is true. |
| critical | Critical value | The t value that starts the rejection region: reject when \|t\| reaches it (two-tailed), t is at or below it (left), or at or above it (right). |
| decision | Decision | Reject the null hypothesis when the p-value is α or less. |
| estimate | Estimate | The sample mean (one-sample), x̄₁ − x̄₂ (two-sample), or the mean difference (paired). |
| se | Standard error | The standard error of the estimate, the denominator of t. |
| pooledSd | Pooled standard deviation | The common standard deviation of the pooled test. Shown for the pooled test only. |

## Method

t = (estimate − μ₀) ÷ SE. One-sample and paired: SE = s ÷ √n, df = n − 1. Welch: SE = √(s₁²/n₁ + s₂²/n₂), df = SE⁴ ÷ ((s₁²/n₁)²/(n₁ − 1) + (s₂²/n₂)²/(n₂ − 1)). Pooled: sp² = ((n₁ − 1)s₁² + (n₂ − 1)s₂²) ÷ (n₁ + n₂ − 2), SE = sp √(1/n₁ + 1/n₂), df = n₁ + n₂ − 2.

## Assumptions

- The observations are independent, and each mean is roughly normal (the data are close to normal, or the samples are large).
- Standard deviations are sample standard deviations (divided by n − 1).
- Welch’s degrees of freedom are fractional; the t distribution is evaluated at that fractional value.

## Worked examples

1. type = two, m1 = 75, s1 = 10, n1 = 30, m2 = 70, s2 = 12, n2 = 35, var = welch, mu0 = 0, tail = two, alpha = 0.05 gives t = 1.832151, df = 62.95882, pValue = 0.071659, decision = Do not reject the null hypothesis. Source: NIST/SEMATECH e-Handbook of Statistical Methods, §1.3.5.3 Two-Sample t-Test for Equal Means. https://www.itl.nist.gov/div898/handbook/eda/section3/eda353.htm.
2. type = two, m1 = 20.14458, s1 = 6.4147, n1 = 249, m2 = 30.48101, s2 = 6.10771, n2 = 79, var = pooled, mu0 = 0, tail = two, alpha = 0.05 gives t = -12.620585, df = 326, pooledSd = 6.342601, critical = 1.967268. Source: NIST/SEMATECH e-Handbook of Statistical Methods, §1.3.5.3 Two-Sample t-Test for Equal Means. https://www.itl.nist.gov/div898/handbook/eda/section3/eda353.htm (T = −12.62059, sp = 6.34260, ν = 326, critical value 1.9673).
3. type = one, m1 = 9.26146, s1 = 0.022789, n1 = 195, mu0 = 5, tail = two, alpha = 0.05 gives t = 2,611.262029, df = 194, critical = 1.972268, decision = Reject the null hypothesis. Source: NIST/SEMATECH e-Handbook of Statistical Methods, §1.3.5.2 Confidence Limits for the Mean (one-sample t-test). https://www.itl.nist.gov/div898/handbook/eda/section3/eda352.htm (T = 2611.284, ν = 194, critical value 1.9723).
4. type = paired, dm = 1.5, ds = 2, np = 10, mu0 = 0, tail = right, alpha = 0.05 gives t = 2.371708, df = 9, pValue = 0.020896, critical = 1.833113. Source: OpenStax, Introductory Statistics 2e, §10.4 Matched or Paired Samples. https://openstax.org/books/introductory-statistics-2e/pages/10-4-matched-or-paired-samples.
5. type = one, m1 = 12, s1 = 3, n1 = 9, mu0 = 10, tail = left, alpha = 0.05 gives t = 2, df = 8, pValue = 0.959742, critical = -1.859548. Source: NIST/SEMATECH e-Handbook of Statistical Methods, §1.3.5.2 Confidence Limits for the Mean (one-sample t-test). https://www.itl.nist.gov/div898/handbook/eda/section3/eda352.htm.

## FAQ

### Which t-test should I use?

Use a one-sample test to compare one mean with a fixed value. Use a two-sample test to compare the means of two independent groups, such as two classes. Use a paired test when each subject is measured twice, such as before and after, and enter the mean and standard deviation of the differences.

### Should I use Welch’s test or the pooled test?

Welch’s test is the safer default: it does not assume the two groups have the same variance, and it loses little when they do. The pooled (Student’s) test assumes equal variances; use it when you have good reason to, or when a course asks for it.

### How is the t statistic calculated?

Divide the difference between the estimate and the hypothesized value by its standard error: t = (x̄ − μ₀) ÷ (s ÷ √n) for one sample. With x̄ = 12, μ₀ = 10, s = 3, and n = 9, t = 2 ÷ 1 = 2, with 8 degrees of freedom.

### What does the p-value mean?

It is the chance, if the null hypothesis is true, of a t statistic at least as extreme as yours in the direction you are testing. When it is at or below your significance level α, the result is called significant and the null hypothesis is rejected.

### What is the difference between a one-tailed and a two-tailed test?

A two-tailed test looks for a difference in either direction, so its p-value counts both tails. A one-tailed test looks in one direction only (less than, or greater than). Choose the direction before you look at the data.

### Can I use raw data instead of summary statistics?

This calculator takes the mean, standard deviation, and size of each sample. To get them from a list of numbers, use the statistics calculator with "sample" chosen; for a paired test, first subtract each pair and enter the differences.

### Why are Welch’s degrees of freedom not a whole number?

The Welch–Satterthwaite formula estimates the degrees of freedom from the two variances and sample sizes, so it usually gives a fraction, such as 62.96. The t distribution is defined for any positive degrees of freedom, and the calculator uses the exact fraction.

## Sources

- NIST/SEMATECH e-Handbook of Statistical Methods, §1.3.5.3 Two-Sample t-Test for Equal Means. https://www.itl.nist.gov/div898/handbook/eda/section3/eda353.htm
- NIST/SEMATECH e-Handbook of Statistical Methods, §1.3.5.2 Confidence Limits for the Mean. https://www.itl.nist.gov/div898/handbook/eda/section3/eda352.htm
- OpenStax, Introductory Statistics 2e, §10.4 Matched or Paired Samples. https://openstax.org/books/introductory-statistics-2e/pages/10-4-matched-or-paired-samples
