Hypothesis Test Calculator
Perform hypothesis testing for population mean with z-test or t-test
Category: Mathematics
Hypothesis Test Calculator Inputs
Hypothesis Test Calculator Formula
Equation
z = \frac\barx - \mu_0\sigma/√(n)
Excel Formula
=z={{x}-_0}{/SQRT(n)}
Variables
- Sample Mean — Enter the Sample Mean value used by the Hypothesis Test Calculator.
- Hypothesized Population Mean (μ₀) — Enter the Hypothesized Population Mean (μ₀) value used by the Hypothesis Test Calculator.
- Sample Size (n) — Enter the Sample Size (n) value used by the Hypothesis Test Calculator.
- Standard Deviation (σ or s) — Enter the Standard Deviation (σ or s) value used by the Hypothesis Test Calculator.
- Test Type — Choose the Test Type option used by the Hypothesis Test Calculator.
- Significance Level (α) — Choose the Significance Level (α) option used by the Hypothesis Test Calculator.
How the Hypothesis Test Calculator Works
Hypothesis testing is a statistical method used to make decisions about population parameters based on sample data. It involves testing a null hypothesis (H₀) against an alternative hypothesis (H₁). The process helps us determine whether observed data provides sufficient evidence to reject a claim about a population parameter, typically the population mean (μ).
The core relationship is z = \frac{\bar{x} - \mu_0}{\sigma/\sqrt{n}}. Typical inputs include Sample Mean, Hypothesized Population Mean (μ₀), Sample Size (n), Standard Deviation (σ or s).
Enter your values in the hypothesis test calculator above, review the step-by-step solution, and compare against the worked examples below so you can see how each input changes the result. This free online mathematics tool is built for homework, design checks, and professional verification.
Hypothesis Test Calculator Theory & Explanation
Fundamental Concepts
Hypothesis testing starts with two competing statements: the null hypothesis (H₀), which represents the status quo or no effect, and the alternative hypothesis (H₁), which represents what we want to prove. The test statistic measures how many standard deviations the sample mean is from the hypothesized population mean.
H_0: \mu = \mu_0 \quad \textvs \quad H_1: \mu ≠ \mu_0
Z-Test Formula
For testing population mean when σ is known (population standard deviation), we use the z-test. The test statistic follows a standard normal distribution. When σ is unknown, we use the sample standard deviation (s) and apply a t-test instead, which follows a t-distribution with (n-1) degrees of freedom.
z = \frac\barx - \mu_0\sigma/√(n) \quad \textor \quad t = \frac\barx - \mu_0s/√(n)
Test Types
Two-tailed test: Used when we want to detect any difference from μ₀ (H₁: μ ≠ μ₀). The rejection region is split equally between both tails. Right-tailed test: Used when testing if μ > μ₀. The rejection region is in the right tail. Left-tailed test: Used when testing if μ < μ₀. The rejection region is in the left tail.
H_1: \mu ≠ \mu_0 \text (two-tailed), \quad H_1: \mu > \mu_0 \text (right-tailed), \quad H_1: \mu < \mu_0 \text (left-tailed)
Significance Level (α)
The significance level (α) is the probability of rejecting H₀ when it is actually true (Type I error). Common values are 0.01, 0.05, and 0.10. A smaller α reduces the chance of false positives but requires stronger evidence to reject H₀. The critical values are determined based on α and the test type.
α = P(\textReject H_0 | H_0 \text is true) = P(\textType I Error)
P-Value Interpretation
The p-value is the probability of observing a test statistic as extreme as, or more extreme than, the calculated value, assuming H₀ is true. If p-value < α, we reject H₀. If p-value ≥ α, we fail to reject H₀. A smaller p-value indicates stronger evidence against H₀.
p\text-value = P(|Z| ≥ |z_\textobs| | H_0 \text is true)
Type I and Type II Errors
Type I Error (α): Rejecting H₀ when it is true (false positive). Type II Error (β): Failing to reject H₀ when it is false (false negative). Power of the test = 1 - β, which is the probability of correctly rejecting a false H₀. There is a trade-off between α and β; reducing one typically increases the other.
α = P(\textType I Error), \quad β = P(\textType II Error), \quad \textPower = 1 - β
Critical Values
Critical values define the boundary of the rejection region. For a two-tailed test at α = 0.05, the critical values are ±1.96 (z-distribution). For right-tailed test at α = 0.05, the critical value is 1.645. For left-tailed test at α = 0.05, the critical value is -1.645. These values change based on the chosen significance level.
z_α/2 = ± 1.96 \text (two-tailed, α = 0.05\text), \quad z_α = 1.645 \text (one-tailed, α = 0.05\text)
Decision Rule
Compare the test statistic with critical values, or compare p-value with α. For two-tailed: Reject H₀ if |z| > z_α/2. For right-tailed: Reject H₀ if z > z_α. For left-tailed: Reject H₀ if z < -z_α. Alternatively, reject H₀ if p-value < α, regardless of test type.
\textReject H_0 \text if p < α \text or if test statistic falls in rejection region
Standard Error
The standard error (SE) measures the variability of the sample mean. It is calculated as the population standard deviation divided by the square root of the sample size. A larger sample size results in a smaller standard error, meaning more precise estimates and more powerful tests.
SE = (\sigma)/(√(n))
Effect Size
Effect size measures the magnitude of the difference between the sample mean and hypothesized population mean, independent of sample size. Cohen's d is commonly used: d = (x̄ - μ₀) / σ. Small effect: d ≈ 0.2, Medium effect: d ≈ 0.5, Large effect: d ≈ 0.8 or greater.
d = \frac\barx - \mu_0\sigma
Hypothesis Test Calculator Worked Examples
Worked Example
Inputs
- sampleMean: 52
- populationMean: 50
- sampleSize: 25
- standardDeviation: 4
- testType: two-tailed
- significanceLevel: 0.05
Result: z = 2.5, p < 0.05, Reject H₀
Explanation
z = (52-50)/(4/√25) = 2/0.8 = 2.5. For α = 0.05, critical value = ±1.96. Since |2.5| > 1.96, reject null hypothesis.
Second Scenario
Inputs
- sampleMean: 62.4
- populationMean: 50
- sampleSize: 25
- standardDeviation: 4
- testType: two-tailed
- significanceLevel: 0.05
Result: z = 2.5, p < 0.05, Reject H₀
Explanation
This scenario uses different inputs (sampleMean = 62.4, populationMean = 50, sampleSize = 25, standardDeviation = 4, testType = two-tailed, significanceLevel = 0.05) to show how changing one variable affects the hypothesis test result. Run the calculator above with these values to get the exact updated output with step-by-step work.
Common Hypothesis Test Calculator Use Cases
- Homework and exam practice
- Engineering and science coursework
- Quick verification of hand calculations
- Hypothesis Test homework and study
- Hypothesis Test design and analysis
Hypothesis Test Calculator FAQs
What is the difference between null and alternative hypotheses?
The null hypothesis (H₀) is the statement being tested, usually representing "no effect" or "no difference" (e.g., μ = μ₀). It represents the status quo or default position. The alternative hypothesis (H₁) is what we want to prove, representing the opposite of the null hypothesis (e.g., μ ≠ μ₀, μ > μ₀, or μ < μ₀). We use sample data to determine whether there is sufficient evidence to reject H₀ in favor of H₁.
What does the p-value represent?
The p-value is the probability of observing a test statistic as extreme as, or more extreme than, the one calculated from your sample data, assuming the null hypothesis is true. A small p-value (typically < 0.05) suggests strong evidence against the null hypothesis, indicating that the observed result is unlikely to have occurred by chance alone. For example, a p-value of 0.01 means there is only a 1% probability of obtaining such extreme results if H₀ were true.
When should I use a one-tailed vs two-tailed test?
Use a one-tailed test when you have a specific directional hypothesis. For example, use a right-tailed test (H₁: μ > μ₀) if you only want to detect increases, or a left-tailed test (H₁: μ < μ₀) if you only want to detect decreases. Use a two-tailed test (H₁: μ ≠ μ₀) when you want to detect any difference from the hypothesized value, regardless of direction. Two-tailed tests are more conservative and commonly used when you don't have a strong directional prediction.
What is the relationship between significance level and Type I error?
The significance level (α) is the probability of rejecting the null hypothesis when it is actually true, which is called a Type I error (false positive). Common values are α = 0.05 (5%) or α = 0.01 (1%). A lower α reduces the chance of Type I error but requires stronger evidence to reject H₀. However, reducing α increases the chance of Type II error (β) - failing to reject H₀ when it is actually false (false negative). This creates a trade-off between the two types of errors.
What is the difference between z-test and t-test?
A z-test is used when the population standard deviation (σ) is known and the sample size is typically large (n ≥ 30). The test statistic follows a standard normal distribution. A t-test is used when the population standard deviation is unknown and must be estimated from the sample data using the sample standard deviation (s). The test statistic follows a t-distribution with (n-1) degrees of freedom. For large samples, the t-distribution closely approximates the normal distribution.
How do I interpret the confidence interval in hypothesis testing?
A 95% confidence interval means that if we repeated the sampling process many times, approximately 95% of the calculated intervals would contain the true population mean. In hypothesis testing, if the hypothesized population mean (μ₀) falls outside the confidence interval, this provides evidence to reject H₀. The confidence interval gives a range of plausible values for the true population mean based on your sample data.
What is effect size and why is it important?
Effect size (Cohen's d) measures the magnitude of the difference between the sample mean and hypothesized population mean, standardized by the standard deviation. Unlike the p-value, effect size is not influenced by sample size and indicates practical significance. Interpretations: d < 0.2 (negligible), 0.2 ≤ d < 0.5 (small), 0.5 ≤ d < 0.8 (medium), d ≥ 0.8 (large). A result can be statistically significant (small p-value) but have a small effect size, meaning it may not be practically important.
What does "fail to reject H₀" mean?
Failing to reject H₀ does NOT prove that H₀ is true. It simply means that the sample data does not provide sufficient evidence to conclude that H₀ is false. This could be because: (1) H₀ is actually true, (2) the sample size is too small to detect a real effect, or (3) there is too much variability in the data. We never "accept" H₀ - we only fail to reject it. This is an important distinction in hypothesis testing logic.
How does sample size affect hypothesis testing?
Larger sample sizes lead to smaller standard errors, which make tests more powerful and able to detect smaller effects. With a very large sample, even tiny, practically meaningless differences can become statistically significant. Conversely, with small samples, you may fail to detect real, important effects (low power). This is why it's important to consider both statistical significance (p-value) and practical significance (effect size) when interpreting results.
What is statistical power and why does it matter?
Statistical power is the probability of correctly rejecting a false null hypothesis (detecting a true effect when it exists). Power = 1 - β, where β is the Type II error rate. Typical target power is 0.80 (80%), meaning an 80% chance of detecting a real effect. Power increases with: larger sample size, larger effect size, higher significance level (α), and lower variability. Low power means you're unlikely to detect a real effect even if it exists, making your study less informative.