# Z-Test Calculator

The calculators below are for data that follow a normal distribution.

Sample mean, x̅
Sample size, n
Population mean, μ
Population standard deviation, σ
 Alternative hypothesis H1: Two tailed, μ≠μ0 Left tail, μ<μ0 Right tail, μ>μ0
Significance level, α
Sample 1
Sample mean, x̅1
Sample size, n1
Population standard deviation, σ1
Sample 2
Sample mean, x̅2
Sample size, n2
Population standard deviation, σ2

Population mean difference, d
 Alternative hypothesis H1: Two tailed, μ1-μ2≠d Left tail, μ1-μ2d
Significance level, α

This Z-test calculator computes data for both one-sample and two-sample Z-tests. It also provides a diagram to show the position of the Z-score and the acceptance/rejection regions. When making a two-sample Z-test calculation, the population mean difference, d, represents the difference between the population means of sample one and sample two, which is μ12. To use this calculator, simply select the type of calculation from the tab, enter the values, and click the 'Calculate' button.

The Z-test is a statistical procedure used to determine whether there is a significant difference between means, either between a sample mean and a known population mean (one-sample Z-test) or between the means of two independent samples (two-sample Z-test). It assumes that the data is normally distributed and is particularly useful when the sample sizes are large (>30) and the population standard deviations are known. When analyzing data to make informed decisions, statistical hypothesis tests are indispensable tools used to determine if evidence exists to reject a prevailing assumption or theory, known as the null hypothesis. The Z-test is one of these tests.

## One-Sample Z-Test

The one-sample Z-test is used when you want to compare the mean of a single sample to a known population mean to see if there is a significant difference. This is particularly common in quality control and other scenarios where the standard deviation of the population is known.

Hypotheses

• Null Hypothesis (H0): The sample mean is equal to the population mean (x̅=μ).
• Alternative Hypothesis (H1): The sample mean is not equal to the population mean (x̅≠μ). This can also be one-tailed (x̅>μ or x̅<μ) depending on the direction of interest.

Formula

The formula for the Z-statistic in a one-sample Z-test is:

Z =
x̅ - μ
 σ √n

where:

• x̅ is the sample mean
• μ is the population mean
• σ is the population standard deviation
• n is the sample size

Example: Suppose a school administrator knows the national average score for a standardized test is 500 with a standard deviation of 50. A sample of 100 students from a new teaching program scores an average of 520. To determine if this program significantly differs from the national average:

Z =
520 - 500
 50 √100
=
 20 5
= 4

This Z-value would then be compared against a critical value from the Z-distribution table typically at a 0.05 significance level. The critical value for a 0.05 significance level is approximately ±1.96. The Z-value of 4 is greater than 1.96. Therefore, the null hypothesis is rejected and the score of this program is considered significantly different from the national average at the 0.05 significance level.

## Two-Sample Z-Test

The two-sample Z-test (or independent samples Z-test) compares the means from two independent groups to determine if there is a statistically significant difference between them.

Hypotheses

• Null Hypothesis (H0): The two population means have a difference of d (μ12=d). If d is 0, the null hypothesis states that the two population means are equal (μ12).
• Alternative Hypothesis (H1): The difference between two population means is not d (μ12≠d), which can also be directional (μ12>d or μ12<d). If d is 0, the alternative hypothesis becomes μ1≠μ2 , or μ12 or μ12 if it is directional.

Formula

The formula for calculating the Z-statistic in a two-sample Z-test is:

Z =
(x̅1 - x̅2) - (μ1 - μ2)
 σ12 n1
+
 σ22 n2

where:

• 1 and x̅2 are the sample means of groups 1 and 2, respectively
• μ1 and μ2 are the population means, with μ1 - μ2 = d. d is often hypothesized to be zero under the null hypothesis.
• σ1 and σ2 are the population standard deviations
• n1 and n2 are the sample sizes of the two groups

Example: Consider two groups of employees from different branches of a company undergoing training. Group A has 50 employees with an average score of 80 and a standard deviation of 10, and Group B has 50 employees with an average score of 75 and a standard deviation of 12. To test if there's a significant difference:

Z =
(80 - 75) - 0
 102 50
+
 122 50
=
 5 2.21
= 2.26

This Z-value is then compared to the critical Z-values to assess significance. The critical value of a 0.05 significance level is around ±1.95. The Z-value of 2.26 is more than 1.95. Therefore, the two group has significant difference at 0.05 significance level.

## Significance Level

The significance level (α) is a critical concept in hypothesis testing. It represents the probability threshold below which the null hypothesis will be rejected. Common levels are 0.05 (5%) or 0.01 (1%). The choice of α affects the Z-critical value, which is used to determine whether to reject the null hypothesis based on the computed Z-score.

• Critical Value: This is a point on the Z-distribution that the test statistic must exceed to reject the null hypothesis. For instance, at a 5% significance level in a two-tailed test, the critical values are approximately ±1.96. The significance level (probability) and critical value (Z-score) can be converted with each other the Z-distribution table or use our Z/P converter.

Using the above examples, if the computed Z-scores exceed the respective critical values, the null hypotheses in each case would be rejected, indicating a statistically significant difference as per the alternative hypotheses. These examples demonstrate how the Z-test is applied in different scenarios to test hypotheses concerning population means.