Z-Test Calculator
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-statistic as well as the acceptance (green) and rejection (red) regions. To clarify, if the z-statistic falls within the green region, there is insufficient evidence to reject the null hypothesis, so we "accept" it; if the z-statistic falls within a red region, there is sufficient evidence to reject the null hypothesis. 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 μ1-μ2. To use this calculator, simply select the desired calculation from the tabs above the calculator, enter the appropriate 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, statistical hypothesis tests are indispensable tools used to determine if evidence exists to reject a prevailing assumption or theory, known as the null hypothesis. These tests allow us to make informed decisions, particularly surrounding whether a studied effect is statistically significant rather than a result of random chance.
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 = |
|
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, first calculate the z-statistic:
z = |
|
= |
|
= 4 |
Then, compare the z-statistic against a critical value from the Z-distribution table. Typically, a significance level of 0.05, which has a critical value of approximately ±1.96, is used. Since a z-statistic of 4 is greater than 1.96, we reject the null hypothesis and can conclude that the score of this program is significantly different from the national average at a 0.05 significance level.
Two-sample Z-test
The two-sample 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 (μ1-μ2=d). If d is 0, the null hypothesis states that the two population means are equal (μ1=μ2).
- Alternative Hypothesis (H1): The difference between two population means is not d (μ1-μ2≠d), which can also be directional (μ1-μ2>d or μ1-μ2<d). If d is 0, the alternative hypothesis becomes μ1≠μ2, or μ1>μ2 or μ1<μ2 if it is directional.
Formula
The formula for calculating the z-statistic in a two-sample Z-test is:
z = |
|
where
- x̅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, first calculate the z-statistic, then compare the z-statistic to the critical z-values for the selected significance level:
z = |
|
= |
|
= 2.26 |
The critical z-value that corresponds to a 0.05 significance level is ±1.96. Since the z-statistic of 2.26 is greater than 1.96, we can conclude that there is a statistically significant difference between the independent groups at a 0.05 significance level.
Significance Level
The significance level (α) is a critical concept in hypothesis testing. It represents the probability threshold below which there is significant evidence to reject the null hypothesis. Common levels are 0.05 (5%) or 0.01 (1%). The choice of α affects the critical z-value, which is used to determine whether to reject the null hypothesis based on the computed z-statistic.
- Critical Value: This is a point on a sampling distribution (in this case the Z-distribution) that defines the regions of the distribution outside of which the test statistic must land in order for there to be a basis for rejecting the null hypothesis. To find the critical value (z-score/z-statistic) that corresponds to a given significance level (probability) use a Z-distribution table or our Z/P converter.
As an example, consider an experiment in which the desired significance level in a two-tailed test is 5%. In this case, the critical values are at approximately ±1.96 on the Z-distribution. Given that the z-statistic is <-1.96 or >+1.96, we would reject the null hypothesis, indicating a statistically significant difference between the two sample population means. On the other hand, if the z-statistic lies between those two critical values, we would have insufficient evidence to reject the null hypothesis.
z-statistic, z-score, and z-value
The terms z-statistic, z-score, and z-value are often used interchangeably, and sometimes inconsistently. For the purposes of this calculator, the terms are used as follows:
z-statistic—this is the term most prevalently used throughout this calculator. It is arguably interchangeable with either "z-score" or "z-value" and is often used as such, but for the purposes of consistency and clarity, we distinguish a z-statistic from the others as the output of a z-test, while a z-score does not take into account a sample size.
z-score—A z-score represents the number of standard deviations a given value deviates from the mean. It differs from a z-statistic in that a z-statistic involves the comparison of a sample and a population mean (or two independent samples) given a known population standard deviation. A z-score in contrast doesn't compare the different types of means. Rather, it is used to standardize data such that the same type of data from two different datasets can be directly compared. The distinction between the two is not very large, but these are the definitions that guide the content of this calculator and website.
z-value—this is typically used as a more general term for either a z-statistic or a z-score. Since this can be ambiguous, for this calculator, we have chosen to use z-value only in the context of critical z-values. For example: "The critical z-value for a significance level of 0.05 in a two-tailed z-test is ±1.96." Outside of this context, we specifically used "z-statistic" to describe the values we obtained from the z-test.