compute the test statistic calculator

Tip: This tool computes the test statistic (z or t). Use it with your chosen significance level and tail direction for final hypothesis-test decisions.

What Is a Test Statistic?

A test statistic is a standardized value that measures how far your sample result is from what the null hypothesis predicts. In plain language, it tells you whether your observed data looks ordinary under the null hypothesis, or unusually far away from it.

When the statistic is close to 0, your sample is close to the null value. As the magnitude grows (for example, a z of 2.8 or a t of -3.1), your sample becomes less consistent with the null model.

How to Compute the Test Statistic (Step-by-Step)

  1. Write your null hypothesis parameter value (for example, μ₀ = 50 or p₀ = 0.40).
  2. Choose the right test setup (z test, t test, or proportion z test).
  3. Calculate the standard error.
  4. Subtract hypothesized value from observed sample value.
  5. Divide by the standard error.

That final ratio is your test statistic.

Common Formulas Used in Hypothesis Testing

1) One-Sample z Test (Mean, Known Population Standard Deviation)

Formula: z = (x̄ - μ₀) / (σ / √n)

  • Use when population standard deviation σ is known.
  • Often used in quality control and large-sample settings.

2) One-Sample t Test (Mean, Unknown Population Standard Deviation)

Formula: t = (x̄ - μ₀) / (s / √n)

  • Use when population σ is unknown (which is common in practice).
  • Degrees of freedom: df = n - 1.

3) One-Sample Proportion z Test

Formula: z = (p̂ - p₀) / √(p₀(1 - p₀)/n), where p̂ = x/n.

  • Use for yes/no outcomes (success/failure).
  • Check sample size conditions so normal approximation is appropriate.

4) Two-Sample t Test (Welch)

Formula: t = [(x̄₁ - x̄₂) - Δ₀] / √(s₁²/n₁ + s₂²/n₂)

  • Compares two independent means.
  • Welch’s test does not require equal variances.

How to Interpret the Number You Get

The sign tells you direction (+ means sample is above null value, - means below). The magnitude tells you strength of departure from the null. Bigger absolute values generally mean stronger evidence against the null hypothesis.

Remember: the test statistic itself is not the final decision. You still compare it to a critical value or convert it into a p-value using your chosen significance level (like α = 0.05).

Assumptions Checklist Before You Trust the Result

  • Random or representative sample.
  • Independent observations.
  • Correct model/test type selected.
  • Reasonable distribution conditions (especially for small samples).
  • No major data entry errors.

Frequent Mistakes to Avoid

  • Using a z test when σ is unknown and sample size is small.
  • Confusing sample standard deviation s with population standard deviation σ.
  • For proportions, entering percentage values like 50 instead of 0.50.
  • Ignoring whether the test is one-tailed or two-tailed.
  • Making causal claims from purely observational data.

Quick Example

Suppose a company claims average shipping time is 5 days. Your sample gives x̄ = 5.8, s = 1.6, n = 36. A one-sample t statistic is:

t = (5.8 - 5) / (1.6 / √36) = 0.8 / 0.2667 ≈ 3.00

A t value near 3 is substantial, so this sample is notably above the claimed average, depending on your test direction and significance level.

Bottom Line

If you need to compute the test statistic quickly and accurately, use the calculator above, pick the correct test type, and enter your sample values carefully. Then pair the result with p-value/critical-value logic to complete your hypothesis test with confidence.

🔗 Related Calculators