t-test calculator
Enter your values. The answer and the full worked solution update as you type.
Result
Run a one-sample, two-sample or paired t-test from summary statistics or from your data. The calculator gives the t statistic, the degrees of freedom (with the Welch–Satterthwaite equation when the variances are not assumed equal), the exact p-value from the t distribution, the critical value, the confidence interval and the decision at your significance level. Every step is shown, so you can follow the method in an exam.
Step-by-step solution
Hypotheses
Standard error
Test statistic
Degrees of freedom
p-value from the t distribution
Decision
Confidence interval
Key formulas
- One-sample t
- t = (x̄ − μ0)/(s/√n), df = n − 1
- Welch t (two samples)
- t = (x̄1 − x̄2)/√(s1²/n1 + s2²/n2)
- Welch df
- df = (s1²/n1 + s2²/n2)² / [(s1²/n1)²/(n1 − 1) + (s2²/n2)²/(n2 − 1)]
- Confidence interval
- x̄ ± tcrit(df)·s/√n
- Decision
- reject H₀ if |t| > tcrit(df)
How to do a t-test
- State the hypotheses. H₀ says that the mean (or the difference in means) equals a value; H₁ says that it is different (two-tailed), smaller (left-tailed) or larger (right-tailed).
- Compute the standard error: s/√n for one sample or for the paired differences, and √(s₁²/n₁ + s₂²/n₂) for two independent samples (or the pooled version when the variances are assumed equal).
- Compute t = (estimate − hypothesised value)/standard error.
- Find the degrees of freedom: n − 1 for one sample or for pairs, n₁ + n₂ − 2 for the pooled test, and the Welch–Satterthwaite equation otherwise.
- Find the p-value from the t distribution, or compare t with the critical value from a t-table.
- Reject H₀ if p ≤ α, which is the same as t lying beyond the critical value. Otherwise, do not reject H₀.
Questions and answers
Should I use Welch’s t-test or the pooled t-test?
Welch’s test does not assume equal variances and is the safer default: it loses very little power when the variances are equal and stays reliable when they are not. Use the pooled test when your course or the question tells you to assume equal population variances.
When do I use a paired t-test?
When each value in one sample belongs to one value in the other, for example the same students before and after a course, or two measurements on the same item. The test then works with the differences, which removes the variation between subjects.
What does the p-value mean?
It is the probability of a t statistic at least as extreme as yours if H₀ were true. A small p-value means that the data are hard to explain by chance alone. It is not the probability that H₀ is true.
Why are the Welch degrees of freedom not a whole number?
The Welch–Satterthwaite equation gives an approximate number of degrees of freedom, which is usually not an integer. The calculator uses the exact value; with a printed table you round down, which gives a slightly more conservative answer.
Is “do not reject H₀” the same as accepting it?
No. It only means that the data do not give enough evidence against H₀ at the chosen significance level. The difference may be real but too small for your sample to detect.
What does the t-test assume?
Independent observations and, for each sample (or for the differences), a roughly normal population. With larger samples, about 30 or more per group, the test is fairly robust against non-normal data because of the central limit theorem.
Practise it yourself
Practise Hypothesis tests & confidence intervals
A calculator gives the answer. In the exam you need the method: practise it with new problems, hints and worked solutions.