Written and maintained by CASRAI Editorial Board
Last updated
A test statistic is the single number a hypothesis test computes from your sample so that the data can be compared with the null hypothesis. The NIST/SEMATECH e-Handbook of Statistical Methods puts it briefly: “The test statistic is based on the specific hypothesis test.” This guide shows how the number is built, how to read it three equivalent ways (critical region, p-value and confidence interval), and where researchers most often misuse it.
Test statistic in hypothesis testing: definition
A test statistic is a function of the sample data that measures how far the observed result lies from what the null hypothesis predicts, expressed in units of the statistic’s own sampling variability. Most test statistics share one shape: signal over noise, that is, (estimate minus null value) divided by the standard error of the estimate. Because its distribution under the null hypothesis is known (for example a t distribution with a stated number of degrees of freedom), the statistic can be turned into a decision: it is compared with a critical value, or converted to a p-value. NIST describes the critical region as “those values of the test statistic that lead to a rejection of the null hypothesis”; the cut-off depends on the statistic’s distribution and on the significance level, alpha.
The statistic is not the same thing as the p-value, the effect size or the significance level. It is the quantity from which the first is derived and against which the third is applied. For the region it is compared with, see rejection region.
Hypothesis testing test statistic: which formula to use
The formula depends on the design and on the null hypothesis. The two t statistics below are given in the NIST e-Handbook (sections 1.3.5.2 and 1.3.5.3); the paired form follows directly from the first.
| Design | Test statistic | Symbols | Reject H0 (two-sided) if |
|---|---|---|---|
| One sample mean against a value μ0 | T = (ȳ − μ0) / (s / √N) | ȳ sample mean, s sample standard deviation, N sample size | |T| > t(1−α/2, N−1) |
| Two independent means, unequal variances | T = (ȳ1 − ȳ2) / √(s1²/N1 + s2²/N2) | ȳ means, s² sample variances, N sample sizes of group 1 and 2 | |T| > t(1−α/2, ν) |
| Paired measurements | One-sample T applied to the within-pair differences, with μ0 = 0 | N is the number of pairs | |T| > t(1−α/2, N−1) |
Other designs (a proportion, categorical counts, a variance ratio) have their own statistics and reference distributions; for the z form see z-score, and for choosing between z and t see z-test vs t-test. The one-sided rules in NIST are: reject if T > t(1−α, ν) for an upper one-sided test, and if T < t(α, ν) for a lower one-sided test.
Worked example: one-sample t statistic with the arithmetic shown
Suppose a lab measures a reference sample ten times and wants to test H0: μ = 50 against Ha: μ ≠ 50 at α = 0.05. The ten readings are 52.1, 48.3, 50.7, 54.2, 49.5, 53.8, 51.0, 55.6, 47.9 and 52.9 (illustrative values constructed for this example, not real data).
- Mean. The readings sum to 516.0, so ȳ = 516.0 / 10 = 51.6.
- Standard deviation. The squared deviations from 51.6 are 0.25, 10.89, 0.81, 6.76, 4.41, 4.84, 0.36, 16.00, 13.69 and 1.69, which total 59.70. The variance is 59.70 / 9 = 6.6333 and s = 2.5755.
- Standard error. s / √10 = 2.5755 / 3.1623 = 0.8144.
- Test statistic. T = (51.6 − 50) / 0.8144 = 1.6 / 0.8144 = 1.9645.
- Critical value. With N − 1 = 9 degrees of freedom, t(0.975, 9) = 2.262.
- Decision. |T| = 1.96 is less than 2.262, so H0 is not rejected at α = 0.05. The exact two-sided p-value is 0.081, which is greater than 0.05.
Those are the same decision stated two ways, and a third agrees: the 95% confidence interval for the mean, 51.6 ± 2.262 × 0.8144, runs from 49.76 to 53.44 and contains 50.
Notice that 1.96 is also the familiar z cut-off. With only 9 degrees of freedom the t distribution has heavier tails than the normal, so the same number falls short of the critical value. If the researcher had committed in advance to the upper one-sided alternative Ha: μ > 50, the critical value would be t(0.95, 9) = 1.833, T would exceed it, and the one-sided p-value would be 0.041. That is why the direction of the alternative must be fixed before the data are seen; see two-tailed hypothesis testing.
As a cited sanity check, the NIST handbook works the same test on its ZARR13.DAT data (H0: μ = 5, α = 0.05, 194 degrees of freedom): T = 2611.284 against a critical value of 1.9723, and NIST rejects the null hypothesis for this two-tailed test because the absolute value of the test statistic is greater than the critical value.
Interpretation: what the test statistic result means
| What you see | How to read it |
|---|---|
| Test statistic inside the critical region | Reject the null hypothesis at the chosen α. Per NIST, the null is rejected “if the test statistic lies within this region.” |
| p-value below α | Reject. NIST defines the p-value as the probability of the test statistic being at least as extreme as the one observed. |
| Test statistic outside the critical region | Do not reject the null. This is not evidence that the null is true. |
| Very large |T| | The observed difference is many standard errors from the null value. It can arise from a large N alone, so read it together with the size of the difference. |
| α = 0.05 | NIST: a true null hypothesis will be wrongly rejected 5% of the time; common choices are 0.1, 0.05 and 0.01. |
For the p-value itself see p-value. The size of the difference is a separate quantity; see effect size. In the example above the standardised difference, (ȳ − μ0) / s, is 1.6 / 2.5755 = 0.62.
Assumptions and common mistakes
- Treating the statistic as the p-value. T = 1.96 is not p = 0.05 here; with 9 degrees of freedom the two-sided p-value is 0.081.
- Treating a big statistic as a big effect. NIST’s ZARR13 statistic of 2611 comes from a very precise estimate (large N), not necessarily a large practical difference. Always report the difference and an effect size.
- Using the two-sided cut-off for a one-sided hypothesis, or the reverse. The critical values differ (2.262 against 1.833 in the example). Choose the direction before collecting data.
- Mixing up the pooled and unequal-variance forms. The two-sample statistic in the table is the unequal-variance form; its degrees of freedom ν are computed by software and are not simply N1 + N2 − 2.
The probability of rejecting a true null hypothesis is the Type I error rate.
How to report the test statistic
Report, in this order: the test used, the degrees of freedom, the value of the statistic, the exact p-value, the size of the difference (here the mean difference with its 95% confidence interval) and an effect size. For the worked example: a one-sample t test showed that the mean (M = 51.6, SD = 2.58, N = 10) did not differ significantly from 50, t(9) = 1.96, p = 0.081, 95% CI [49.76, 53.44]. State α and whether the test was one- or two-sided. Check your target journal’s author guidelines for its required notation, such as decimal places and italics.
How to calculate it in Excel, R or Python
Excel
With the readings in A1:A10:
=(AVERAGE(A1:A10)-50)/(STDEV.S(A1:A10)/SQRT(COUNT(A1:A10))) -> T = 1.9645
=T.DIST.2T(ABS(1.9645),9) -> two-sided p = 0.081
=T.INV.2T(0.05,9) -> critical value = 2.262
R
x <- c(52.1, 48.3, 50.7, 54.2, 49.5, 53.8, 51.0, 55.6, 47.9, 52.9)
t.test(x, mu = 50) # t = 1.9645, df = 9, p-value = 0.08105
qt(0.975, df = 9) # critical value 2.262
Python
from scipy import stats
x = [52.1, 48.3, 50.7, 54.2, 49.5, 53.8, 51.0, 55.6, 47.9, 52.9]
res = stats.ttest_1samp(x, popmean=50)
print(res.statistic, res.pvalue) # 1.9645, 0.0811
print(stats.t.ppf(0.975, df=9)) # 2.262
FAQ
What is a test statistic in hypothesis testing?
It is the number computed from the sample that summarises how far the data are from the null hypothesis, in standard-error units. It is compared with a critical value or converted to a p-value to make the reject or do-not-reject decision.
Is the test statistic the same as the p-value?
No. The p-value is the probability of a test statistic at least as extreme as the one observed, assuming the null hypothesis is true. The statistic is the observed value itself.
Can a test statistic be negative?
Yes. In T = (ȳ − μ0) / (s / √N) the sign shows the direction of the difference. A two-sided test uses the absolute value; a lower one-sided test rejects when T is below t(α, ν).
Which test statistic should I use?
Start from the design (one mean, two independent means, paired measurements) and the null hypothesis, then use the statistic specific to that test. See t-test for the t family.
Sources
- NIST/SEMATECH e-Handbook of Statistical Methods, 1.3.5 Quantitative Techniques (hypothesis test elements), itl.nist.gov/div898/handbook/eda/section3/eda35.htm, checked 2026-10-29.
- NIST/SEMATECH e-Handbook, 1.3.5.2 One-Sample t-Test, itl.nist.gov/div898/handbook/eda/section3/eda352.htm, checked 2026-10-29.
- NIST/SEMATECH e-Handbook, 1.3.5.3 Two-Sample t-Test for Equal Means, itl.nist.gov/div898/handbook/eda/section3/eda353.htm, checked 2026-10-29.
- NIST/SEMATECH e-Handbook, hypothesis test critical values and p-values, itl.nist.gov/div898/handbook/prc/section1/prc131.htm, checked 2026-10-29.








