Mathwords logoMathwords

Test Statistic — Definition, Formula & Examples

A test statistic is a single number calculated from sample data that measures how far your observed result is from what the null hypothesis predicts. The larger the test statistic's absolute value, the stronger the evidence against the null hypothesis.

A test statistic is a standardized value derived from sample data during a hypothesis test, computed as the ratio of the departure of the sample estimate from its hypothesized parameter value to the standard error of the estimate. Its sampling distribution under the null hypothesis (such as the standard normal, tt, or χ2\chi^2 distribution) determines the corresponding p-value.

Key Formula

z=p^p0p0(1p0)nz = \frac{\hat{p} - p_0}{\sqrt{\dfrac{p_0(1 - p_0)}{n}}}
Where:
  • zz = Test statistic (z-score)
  • p^\hat{p} = Sample proportion
  • p0p_0 = Hypothesized population proportion under the null hypothesis
  • nn = Sample size

How It Works

To use a test statistic, you first state a null hypothesis about a population parameter. Then you collect sample data, compute the sample estimate, and plug it into the appropriate formula to get the test statistic. This value tells you how many standard errors your sample result sits from the hypothesized value. You compare the test statistic to a critical value or use it to find a p-value, which tells you whether the difference is statistically significant. Different situations call for different test statistics: a zz-statistic when the population standard deviation is known, a tt-statistic when it is estimated from the sample, or a χ2\chi^2-statistic for categorical data.

Worked Example

Problem: A company claims that 50% of customers prefer its product. You survey 200 customers and find that 120 prefer it. At a significance level of 0.05, calculate the test statistic for a one-proportion z-test.
Identify the values: The null hypothesis is p0=0.50p_0 = 0.50. The sample proportion is p^=120/200=0.60\hat{p} = 120/200 = 0.60, and n=200n = 200.
p^=120200=0.60\hat{p} = \frac{120}{200} = 0.60
Compute the standard error: Use the hypothesized proportion to find the standard error under the null hypothesis.
SE=0.50×0.50200=0.25200=0.001250.0354SE = \sqrt{\frac{0.50 \times 0.50}{200}} = \sqrt{\frac{0.25}{200}} = \sqrt{0.00125} \approx 0.0354
Calculate the test statistic: Divide the difference between the sample proportion and the hypothesized proportion by the standard error.
z=0.600.500.03542.83z = \frac{0.60 - 0.50}{0.0354} \approx 2.83
Interpret the result: A z-value of 2.83 means the sample proportion is about 2.83 standard errors above the hypothesized value. The two-tailed p-value is approximately 0.0047, which is less than 0.05, so you reject the null hypothesis.
Answer: The test statistic is z2.83z \approx 2.83. Since this exceeds the critical value of 1.96 for a two-tailed test at α=0.05\alpha = 0.05, there is significant evidence that the true proportion differs from 50%.

Another Example

Problem: A teacher believes the mean score on a test is 75. A sample of 36 students has a mean of 72 and a sample standard deviation of 9. Calculate the t-test statistic.
Identify the values: The null hypothesis is μ0=75\mu_0 = 75. The sample mean is xˉ=72\bar{x} = 72, the sample standard deviation is s=9s = 9, and n=36n = 36.
Compute the standard error: Divide the sample standard deviation by the square root of the sample size.
SE=sn=936=96=1.5SE = \frac{s}{\sqrt{n}} = \frac{9}{\sqrt{36}} = \frac{9}{6} = 1.5
Calculate the test statistic: Subtract the hypothesized mean from the sample mean and divide by the standard error.
t=72751.5=31.5=2.0t = \frac{72 - 75}{1.5} = \frac{-3}{1.5} = -2.0
Answer: The test statistic is t=2.0t = -2.0 with df=35df = 35. The sample mean is 2 standard errors below the hypothesized mean.

Visualization

Why It Matters

Test statistics are central to every hypothesis test you encounter in AP Statistics and college-level inference courses. In fields like medicine, researchers use test statistics to decide whether a new drug performs better than a placebo. Quality-control engineers rely on them to determine whether a manufacturing process has drifted out of specification.

Common Mistakes

Mistake: Using the sample proportion or sample standard deviation in the denominator of a one-proportion z-test instead of the null hypothesis value.
Correction: For one-proportion z-tests, always use p0p_0 (the hypothesized proportion) when computing the standard error, because you are measuring distance assuming the null hypothesis is true.
Mistake: Interpreting the test statistic as a probability.
Correction: The test statistic is a standardized distance, not a probability. Convert it to a p-value using the appropriate distribution table or calculator before drawing conclusions.