Hypothesis Testing Calculator

Hypothesis Testing Calculator

Test a population-mean hypothesis from summary statistics, raw sample data, or a known Z score, with live p-values, critical values, and a decision at your chosen significance level.

Method Z test p-value 0.0062 α 0.0500 Decision Reject H₀
Excel workbook ready for the demonstration data.

Setup and data

H₀: μ = 500; H₁: μ ≠ 500
Choose left-tailed, two-tailed, or right-tailed.
The population mean claimed by H₀.
Enter a decimal strictly between 0 and 1.
Select the information you already have.
Arithmetic mean of the observed sample.
Whole number from 2 to 1,000,000.
Must be positive and in the same units as the mean.

Live result

P-value
0.0062
Reject H₀ at α = 0.0500.
Test MethodZ test
Test Statisticz = -2.7386
Critical Value±1.9600
Standard Error1.8257
Degrees of Freedom –
Observed Mean495.0000
Difference from μ₀-5.0000
Two-tailed Z test: p = 0.0062, so reject H₀ at α = 0.0500.

Calculation details

Metric Current value Interpretation
The table is rebuilt from the same canonical calculation used for the headline result and the Excel workbook. Values are shown at presentation precision; the workbook stores canonical numeric values.

How to use this hypothesis testing calculator

What this calculator does

This calculator evaluates a one-sample hypothesis about a population mean. It compares the sample evidence with a null mean, computes the appropriate test statistic and tail probability, and applies your significance level to return a reject-or-fail-to-reject decision. It supports summary statistics, raw numeric observations, and an already-computed Z score. For summary or raw data, it uses a one-sample t distribution when the sample has fewer than 30 observations and the normal Z approximation when the sample has 30 or more observations, matching the workflow represented by this calculator. It does not establish the probability that a hypothesis is true, measure practical importance, or repair problems in sampling and study design. For the standard one-sample t framework and its assumptions, see Penn State's one-sample mean t-test formulas and decision procedure.

When to use it

Use it when you want to check whether a sample mean differs from a benchmark, whether it is below a minimum target, whether it exceeds a claimed level, or when another analysis has already produced a Z score and you need its p-value and critical threshold. Typical examples include comparing average fill weight with a labeled target, checking a process mean against a specification, or evaluating whether an observed average has moved in a stated direction.

How to calculate

  1. The calculator opens with a ready-to-use demonstration: H₀ uses μ₀ = 500, H₁ is two-tailed, α = 0.05, x̄ = 495, n = 30, and sd = 10. The result and a validated example Excel workbook are available immediately.
  2. Choose Alternative Hypothesis H₁: μ < μ₀ for a left-tailed claim, μ ≠ μ₀ for a two-tailed claim, or μ > μ₀ for a right-tailed claim.
  3. Enter the Null Mean (μ₀) and Significance Level (α), then choose the Data Type that matches the information you have.
  4. For summary statistics, replace Sample Mean (x̄), Sample Size (n), and Sample Standard Deviation (sd). For raw data, paste observations into Raw Sample Data. For a known standardized statistic, enter the Z Score.
  5. Read the p-value, method, statistic, critical value, standard error, degrees of freedom, observed mean, and difference. Download Excel to preserve the current validated state. Reset clears the demonstration and all semantic data; Download Excel is then disabled until a complete valid state is entered again.

Input guide

Alternative Hypothesis H₁ is required and determines which tail area becomes the p-value. Choose the direction before interpreting the result; switching from μ ≠ μ₀ to μ > μ₀ or μ < μ₀ can materially change the p-value. Null Mean (μ₀) is a required finite number in the same measurement units as your sample mean, such as 500 grams. It is not used in direct Z-score mode because the score is already standardized. Significance Level (α) is required as a decimal between 0 and 1; 0.05 means 5%. Do not enter 5 when you mean 5%.

Data Type is required. In Mean, sample size & sample SD mode, Sample Mean (x̄) is any finite number, Sample Size (n) must be an integer from 2 through 1,000,000, and Sample Standard Deviation (sd) must be positive; 495, 30, and 10 are a realistic example set. A larger absolute gap between x̄ and μ₀ tends to increase the magnitude of the test statistic; a larger sd tends to reduce it; a larger n tends to reduce standard error. In Raw sample data mode, provide 2 to 5,000 finite observations separated by spaces, line breaks, semicolons, or spaced commas; for example, 492 501 488 497 503. Decimal points are accepted; compact decimal-comma forms such as 1,5 are rejected as ambiguous. In Known Z score mode, enter a finite Z statistic from -50 to 50, for example -2.74. Scientific notation is intentionally rejected in these fields so pasted values cannot be silently reinterpreted.

Output guide

P-value is the tail probability, under the null model and test assumptions, of a statistic at least as extreme in the selected direction. Smaller values indicate greater incompatibility with the null model under those assumptions; in a two-tailed test, a statistic of zero gives p = 1. Decision says “Reject H₀” when p ≤ α and “Fail to reject H₀” otherwise; failing to reject is not proof that H₀ is true. Test Method identifies the Z or one-sample t calculation. Test Statistic is the standardized distance from the null mean, with its sign showing direction. Critical Value marks the rejection boundary for the selected α and tail direction. Standard Error is sd/√n for sample-based modes, so smaller standard error makes a fixed mean difference more standardized. Degrees of Freedom is n – 1 for the t test and is not applicable to the Z test. Observed Mean is the entered or raw-data mean, and Difference from μ₀ is x̄ – μ₀; zero means the observed mean equals the null benchmark. In the calculation details table, Metric names the component, Current value gives its formatted value, and Interpretation explains its role in the test. NIST publishes both standard normal cumulative probabilities and critical Z values and critical values of Student's t distribution.

Worked example

With μ₀ = 500, x̄ = 495, n = 30, and sd = 10, the standard error is 10/√30 = 1.8257. The standardized statistic is (495 – 500)/1.8257 = -2.7386. Because the selected alternative is two-tailed and α = 0.05, the normal critical values are approximately -1.9600 and +1.9600. The two-tailed p-value is about 0.0062, which is below 0.05, so the calculator returns Reject H₀. These values are the same values shown on first open and written to the demonstration workbook.

How the test statistic and p-value work

For sample-based modes, the core standardized statistic is the difference between the observed mean and null mean divided by the estimated standard error:

statistic = (x̄ – μ₀) / (sd / √n)

For smaller samples, the calculator evaluates this statistic using a Student t distribution with n – 1 degrees of freedom. For n ≥ 30, it uses the standard normal approximation. The selected alternative determines whether probability is taken from the left tail, right tail, or both tails. The critical value is computed from the same distribution and α, so the p-value decision and critical-region decision are consistent.

What should you avoid when interpreting a hypothesis test?

A p-value is conditional on the null model and the assumptions used to calculate it. It is not the probability that H₀ is true, and statistical significance is not the same as a large or important effect. The American Statistical Association's statement on statistical significance and p-values recommends interpreting p-values in context rather than using a threshold as a complete scientific or business conclusion. Check how the sample was obtained, whether observations are suitably independent, whether a mean-based model is appropriate, and whether the observed difference is meaningful in the domain.

Also distinguish a directional hypothesis chosen before looking at the data from a direction selected afterward. A one-tailed test concentrates α in one tail and therefore changes both the p-value and critical boundary. If the research question allows meaningful departures in either direction, the two-tailed alternative is generally the coherent choice.