Test Statistic Calculator

Compute test statistics, p-values, critical values, and draw statistical conclusions for Z-test, t-test, Chi-Square test, and F-test.Visualize the sampling distribution, critical regions, and make informed hypothesis-testing decisions.

Supports Tab / Comma / Space
Z-Test — Used when population standard deviation (σ) is known. Assumes normal population or large sample (n ≥ 30) via CLT.
Quick Examples: Z: μ₀=100, x̄=102.5, σ=15, n=36 Z: μ₀=100, x̄=110, σ=12, n=40 T: μ₀=100, x̄=103, s=16, n=25 χ²: O=50,30,20 E=40,35,25 F: s₁²=25, n₁=20, s₂²=15, n₂=18 Z raw: 98,102,100.5,97,103 (σ=5) T raw: 98,102,100.5,97,103 F raw: 10,12,14 / 20,22,24
Privacy first: All calculations are performed locally in your browser. No data is sent to any server.

Understanding Test Statistics: A Comprehensive Guide

In statistical hypothesis testing, a test statistic is a standardized value computed from sample data that is used to determine whether to reject the null hypothesis. It measures the compatibility between the observed data and what would be expected under the null hypothesis. The choice of test statistic depends on the type of data, the parameter of interest, and the assumptions about the population distribution.

General form: Test Statistic = (Sample Estimate − Hypothesized Value) / Standard Error

The numerator measures the difference; the denominator scales it by variability.

The Four Pillars of Hypothesis Testing

Z-Test

Used when the population variance is known. The test statistic follows a standard normal distribution under the null. Suitable for large samples (n ≥ 30) or known σ.

T-Test

Used when the population variance is unknown and estimated from the sample. The test statistic follows a t-distribution with n−1 degrees of freedom. Robust to moderate departures from normality.

Chi-Square Test

Used for categorical data to compare observed frequencies with expected frequencies. The test statistic follows a chi-square distribution with k−1 degrees of freedom (where k is number of categories).

F-Test

Used to compare two population variances. The test statistic is the ratio of sample variances and follows an F-distribution with (n₁−1, n₂−1) degrees of freedom. Sensitive to normality assumptions.

Mathematical Foundations

Z-Test Formula

Z = (x̄ − μ₀) / (σ / √n)

where is the sample mean, μ₀ is the hypothesized population mean, σ is the known population standard deviation, and n is the sample size. Under the null hypothesis, Z ~ N(0,1).

T-Test Formula

t = (x̄ − μ₀) / (s / √n)

where s is the sample standard deviation. Under the null, t follows a t-distribution with ν = n − 1 degrees of freedom.

Chi-Square Test Formula

χ² = Σ (Oᵢ − Eᵢ)² / Eᵢ

where Oᵢ are observed frequencies and Eᵢ are expected frequencies. Under the null, χ² follows a chi-square distribution with k − 1 degrees of freedom (or k − 1 − p if parameters are estimated).

F-Test Formula

F = s₁² / s₂²

where s₁² and s₂² are the sample variances from two independent populations. Under the null hypothesis (σ₁² = σ₂²), F follows an F-distribution with (ν₁ = n₁ − 1, ν₂ = n₂ − 1) degrees of freedom.

How to Interpret Results

  • p-value: The probability of observing a test statistic as extreme as, or more extreme than, the one computed, assuming the null hypothesis is true. A small p-value (typically ≤ α) suggests that the observed data are unlikely under the null, leading to rejection of H₀.
  • Critical Value: The threshold that the test statistic must exceed (in absolute value for two-tailed tests) to reject the null hypothesis at the given significance level α.
  • Decision Rule: If |test statistic| > |critical value| (or p-value < α), reject the null hypothesis. Otherwise, fail to reject the null.
  • Effect Size: While significance tells you whether an effect exists, effect size (e.g., Cohen's d) tells you how large the effect is. Always consider practical significance alongside statistical significance.
Case Study: Pharmaceutical Drug Efficacy

A clinical trial tests whether a new drug lowers blood pressure more effectively than a placebo. The null hypothesis is that the mean reduction in blood pressure is the same for both groups (μ_drug = μ_placebo). Using a two-sample t-test, researchers obtain a test statistic of t = 2.85 with p = 0.005 (α = 0.05). Since p < 0.05, they reject the null hypothesis and conclude that the drug significantly lowers blood pressure. The 95% confidence interval for the mean difference ranges from 3.2 to 8.7 mmHg, providing both statistical and practical significance. This tool can replicate such analyses in seconds.

Common Mistakes & Misconceptions

  • “p-value is the probability that the null hypothesis is true.” — False. The p-value is the probability of the data (or more extreme) given that H₀ is true, not the probability of H₀ given the data.
  • “A non-significant result means the null hypothesis is true.” — False. Failure to reject H₀ does not prove H₀ is true; it simply means there is insufficient evidence to reject it. The sample may be too small or the effect too subtle to detect.
  • “You can choose your alternative hypothesis after seeing the data.” — False. Hypotheses must be pre-specified to avoid p-hacking and to maintain the validity of the test.
  • “All tests require normally distributed data.” — False. While the t-test and F-test have normality assumptions, the Z-test relies on the CLT for large samples, and the chi-square test is distribution-free for categorical data (though expected counts must be adequate).

Real-World Applications

Finance

Testing whether a portfolio's average return differs from a benchmark index (Z-test or t-test). Also used in risk analysis (F-test for variance comparison).

Biology & Medicine

Comparing gene expression levels between groups (t-test), testing for Hardy-Weinberg equilibrium (chi-square), or comparing variances in assay reproducibility (F-test).

Manufacturing & Quality Control

Testing whether the mean diameter of produced parts meets specifications (Z/t-test), or comparing the variability of two production lines (F-test).

Social Sciences

Analyzing survey data to test for demographic differences (chi-square), or comparing means between treatment and control groups in experiments (t-test).

Machine Learning

Comparing model performance metrics (e.g., accuracy) between algorithms using paired t-tests, or testing feature independence using chi-square tests.

Environmental Science

Testing whether pollutant concentrations differ across sites (t-test), or whether categorical land-use patterns follow expected distributions (chi-square).

Reference Tables: Critical Values

Test Distribution df α = 0.05 (two-tailed) α = 0.01 (two-tailed)
Z-Test N(0,1) ±1.960 ±2.576
T-Test t(10) 10 ±2.228 ±3.169
T-Test t(30) 30 ±2.042 ±2.750
Chi-Square χ²(4) 4 9.488 13.277
Chi-Square χ²(5) 5 11.071 15.086
F-Test F(10,10) (10,10) 2.978 4.849
F-Test F(20,15) (20,15) 2.329 3.369

Built on Statistical Rigor – This tool implements hypothesis testing procedures based on foundational principles from Fisher, Neyman, and Pearson. The computational methods are derived from authoritative sources including Statistical Inference by Casella & Berger, Introduction to the Practice of Statistics by Moore, McCabe, and Craig, and the NIST/SEMATECH e-Handbook of Statistical Methods. All algorithms have been cross-verified against R and Python statistical packages. Reviewed by the GetZenQuery tech team, last updated June 2026.

Frequently Asked Questions

A test statistic is a numerical summary of sample data that is used in hypothesis testing to decide whether to reject the null hypothesis. It standardizes the difference between the sample estimate and the hypothesized value by the standard error, allowing comparison to a known probability distribution. It is the central pillar of frequentist statistical inference.

Use a Z-test when the population standard deviation (σ) is known, or when the sample size is large (n ≥ 30) and σ can be reliably estimated from the sample (by the CLT). Use a T-test when σ is unknown and estimated from the sample (s), especially for smaller samples (n < 30), as the t-distribution accounts for the additional uncertainty.

A two-tailed test detects deviations in either direction from the null hypothesis (e.g., μ ≠ μ₀). A one-tailed test detects deviations in a specific direction (e.g., μ > μ₀ or μ < μ₀). The choice depends on the research question and should be pre-specified. One-tailed tests have more power to detect an effect in the specified direction but cannot detect effects in the opposite direction.

Degrees of freedom (df) represent the number of independent pieces of information available to estimate a parameter. For a t-test, df = n − 1 because one parameter (the mean) is estimated from the data. For an F-test, df₁ = n₁ − 1 and df₂ = n₂ − 1. For a chi-square test, df = k − 1 (number of categories minus 1). Higher df generally means the distribution is more concentrated around its mean.

A very small p-value (e.g., p < 0.001) indicates strong evidence against the null hypothesis — the observed data are highly unlikely under H₀. This suggests a genuine effect. A very large p-value (e.g., p > 0.50) indicates that the observed data are consistent with H₀, providing no evidence to reject it. However, a large p-value does not prove H₀ is true; it may simply reflect low power (small sample size or small effect size).

This calculator currently supports one-sample tests (Z, t, chi-square goodness of fit) and the two-sample F-test for variances. For paired t-tests or two-sample t-tests (independent samples), please see our dedicated tools: Paired T-Test Calculator and Two-Sample T-Test Calculator.
References & Further Reading: NIST/SEMATECH e-Handbook; Casella, G. & Berger, R.L. (2002). Statistical Inference, 2nd ed.; Moore, D.S., McCabe, G.P., & Craig, B.A. (2017). Introduction to the Practice of Statistics, 9th ed.; Wikipedia: Test Statistic.