ThisCalculator

Statistics

Test Statistic Calculator: Formula and Examples

Updated · Standard formula, shown below

The calculator for this page is switched off while it is checked. The formula is below, and the worked example in the article shows how to use it by hand.

Test Statistic Calculator: Formula and Examples

A test statistic measures how far a sample result is from what a statistical null hypothesis predicts, in units of estimated standard error. Enter the observed sample mean, the hypothesized mean, the sample standard deviation, and the sample size to calculate a one-sample t statistic; the result is the signed test statistic.

Formula

For a one-sample t test, the test statistic is t = (x̄ − μ₀) / (s / √n). Here, x̄ is the observed sample mean, μ₀ is the mean specified by the null hypothesis, s is the sample standard deviation, and n is the number of independent observations. The denominator, s / √n, is the estimated standard error of the sample mean. The statistic has no physical unit: the numerator and denominator use the same measurement unit, so those units cancel.

This calculator uses a t statistic because the population standard deviation is not supplied and is estimated using the sample standard deviation. For the usual one-sample t procedure, the degrees of freedom are n − 1. The calculator reports the statistic and standard error; it does not calculate a p-value or decide whether to reject the null hypothesis.

Worked Example

Using the defaults, the sample mean is 12, the hypothesized mean is 10, the sample standard deviation is 4, and the sample size is 16. First calculate the standard error:

SE = 4 / √16 = 4 / 4 = 1.

Then subtract the hypothesized mean from the sample mean and divide by the standard error:

t = (12 − 10) / 1 = 2.000.

The reported test statistic is therefore 2.000, with a standard error of 1.000 in the sample measurement unit. The corresponding degrees of freedom for the conventional one-sample t test are 16 − 1 = 15.

What a Test Statistic Tells You

The statistic expresses the sample’s distance from the null-hypothesis value relative to the uncertainty in the estimate. A t value of 2 means the sample mean is two estimated standard errors above the hypothesized mean. A value of −2 would mean it is two standard errors below it. The sign shows direction; the magnitude shows distance on the test’s standardized scale.

A larger absolute statistic is generally less consistent with the null model, but it is not itself the probability that the null hypothesis is true. Nor does a statistic alone establish practical importance. A small difference can produce a large statistic when the standard error is small, while a substantial-looking difference can produce a modest statistic when the data are variable or the sample is small.

When to Use This Calculation

Use this form when a question concerns whether a population mean differs from a specified value and the available data can reasonably be summarized by a sample mean, sample standard deviation, and sample size. For example, if 16 independent measurements have a mean of 12 units and a sample standard deviation of 4 units, this calculation tests the sample mean against a null value of 10 units.

Before interpreting the result, check that the observations are independent and that the sampling design supports the inference. A one-sample t procedure is especially sensitive to serious skewness or outliers in small samples. With larger samples, the distribution of the sample mean is often more nearly normal, but a large sample does not fix dependence, biased sampling, or flawed measurements.

Choosing the Right Test Statistic

“Test statistic” is a general term, not the name of one universal formula. The correct statistic depends on the hypothesis, data type, study design, and assumptions. This calculator specifically handles a one-sample t test for a mean. Other common situations require different calculations:

  • One-sample z test: often used for a mean when the population standard deviation is known and the model’s assumptions are appropriate.
  • Paired t test: applies a one-sample t calculation to the differences within matched pairs or repeated measurements.
  • Two-sample t test: compares means from two groups; the standard error must reflect the two-sample design, and the equal-variance assumption matters for the pooled version.
  • Proportion or categorical-data tests: use statistics designed for proportions or counts, such as a z or chi-square statistic, rather than this mean-based formula.

Do not substitute a standard deviation for the standard error in the formula. The standard deviation describes variation among individual observations; the standard error describes uncertainty in the sample mean and, here, divides the sample standard deviation by √n.

From Statistic to a Conclusion

To obtain a p-value, specify whether the alternative hypothesis is two-sided or one-sided, use the t distribution with n − 1 degrees of freedom, and compare the result with that distribution. A two-sided test considers extreme values in either direction; a one-sided test considers only the direction stated in advance by the alternative hypothesis. The same t statistic can therefore correspond to different p-values under different alternatives.

A decision also depends on the chosen significance level and the analysis plan. Report the statistic with its degrees of freedom and p-value where relevant, and consider a confidence interval and an effect size to describe the estimate’s uncertainty and practical scale. Avoid rounding intermediate values too early: calculate the standard error from full precision, then round the displayed result.

Frequently Asked Questions

What is a test statistic in simple terms?
A test statistic puts the observed result on a scale that measures its distance from the null-hypothesis prediction relative to expected sampling variation. Its precise meaning depends on the statistical test used.

Can I calculate a test statistic without a sample size?
Not with this one-sample t formula: the standard error requires n. You also need the sample mean, hypothesized mean, and sample standard deviation. A different test may require different inputs.

What does a negative t statistic mean?
It means the observed sample mean is below the hypothesized mean. The sign gives direction, while the absolute value indicates how many estimated standard errors separate the two means.

Is the test statistic the same as the p-value?
No. The statistic is a standardized result calculated from the data. A p-value is obtained by comparing that statistic with a reference distribution, while accounting for the test direction and degrees of freedom.

What if the population standard deviation is known?
A one-sample z statistic may be appropriate when the population standard deviation is genuinely known and the test assumptions are met. This calculator instead uses the sample standard deviation and reports a t statistic.

Related

Formula used
in xbar | Sample mean | - | 12 | 
in mu0 | Hypothesized mean | - | 10 | 
in s | Sample standard deviation | - | 4 | 0
in n | Sample size | - | 16 | 1
out t | Test statistic (t) | - | (xbar - mu0) / (s / sqrt(n)) | 3
out se | Standard error | - | s / sqrt(n) | 3

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.