This Z-test calculator is a tool that helps you perform a one-sample Z-test on the population's mean. Two forms of this test - a two-tailed Z-test and a one-tailed Z-tests - exist, and can be used depending on your needs. You can also choose whether the calculator should determine the p-value from Z-test, or you'd rather use the critical value approach! Read on to learn more about Z-test in statistics, and, in particular, when to use Z-tests, what is the Z-test formula, and whether to use Z-test vs. t-test. As a bonus, we give some step-by-step examples of how to perform Z-tests! Or you may also check our t-statistic calculator, where you can learn the concept of another essential statistic. If you are also interested in F-test, check our F-statistic calculator.
A one sample Z-test is one of the most popular location tests. The null hypothesis is that the population mean value is equal to a given number, μ₀: H₀: μ = μ₀ We perform a two-tailed Z-test if we want to test whether the population mean is not μ₀: H₁: μ ≠ μ₀, and a one-tailed Z-test if we want to test whether the population mean is less/greater than μ₀: H₁: μ < μ₀ (left-tailed test); and H₁: μ > μ₀ (right-tailed test). Let us now discuss the assumptions of a one-sample Z-test.
You may use a Z-test if your sample consists of independent data points and:
The reason these two possibilities exist is that we want the test statistics that follow the standard normal distribution N(0,1). In the former case, it is an exact standard normal distribution, while in the latter, it is approximately so, thanks to the central limit theorem. The question remains, "When is my sample considered large?" Well, there's no universal criterion. In general, the more data points you have, the better the approximation works. Statistics textbooks recommend having no fewer than 50 data points, while 30 is considered the bare minimum.
Let x1, ..., xn be an independent sample following the normal distribution N(μ, σ²), i.e., with a mean equal to μ, and variance equal to σ². We pose the null hypothesis, H₀: μ = μ₀ We define the test statistic, Z, as: Z = (x̄ - μ0) * √n / σ where:
In what follows, the uppercase Z stands for the test statistic (treated as a random variable), while the lowercase z will denote an actual value of Z, computed for a given sample drawn from N(μ,σ²). If H₀ holds, then the sum Sn = x1 + ... + xn follows the normal distribution, with mean n * μ0 and variance n² * σ. As Z is the standardization (z-score) of Sn/n, we can conclude that the test statistic Z follows the standard normal distribution N(0,1), provided that H₀ is true. If our data does not follow a normal distribution, or if the population standard deviation is unknown (and thus in the formula for Z we substitute the population standard deviation σ with sample standard deviation), then the test statistics Z is not necessarily normal. However, if the sample is sufficiently large, then the central limit theorem guarantees that Z is approximately N(0,1). In sections below, we will explain to you how to use the value of the test statistic, z, to make a decision, whether or not you should reject the null hypothesis. Two approaches can be used in order to arrive at that decision: the p-value approach, and critical value approach - and we cover both of them! Which one should you use? In the past, the critical value approach was more popular because it was difficult to calculate p-value from Z-test. However, with help of modern computers, we can do it fairly easily, and with decent precision. In general, you are strongly advised to report the p-value of your tests!
Formally, the p-value is the smallest level of significance at which the null hypothesis could be rejected. More intuitively, p-value answers the questions: To find the p-value, you have to calculate the probability that the test statistic, Z, is at least as extreme as the value we've actually observed, z, provided that the null hypothesis is true. (The probability of an event calculated under the assumption that H0 is true will be denoted as Pr(event | H0).) It is the alternative hypothesis which determines what more extreme means:
To compute these probabilities, we can use the cumulative distribution function, (cdf) of N(0,1), which for a real number, x, is defined as: Also, p-values can be nicely depicted as the area under the probability density function (pdf) of N(0,1), due to: Pr(Z ≤ x | H0) = Φ(x) = the area to the left of x Pr(Z ≥ x | H0) = 1-Φ(x) = the area to the right of x
With all the knowledge you've got from the previous section, you're ready to learn about Z-tests.
The decision as to whether or not you should reject the null hypothesis can be now made at any significance level, α, you desire!
The critical value approach involves comparing the value of the test statistic obtained for our sample, z, to the so-called critical values. These values constitute the boundaries of regions where the test statistic is highly improbable to lie. Those regions are often referred to as the critical regions, or rejection regions. The decision of whether or not you should reject the null hypothesis is then based on whether or not our z belongs to the critical region. The critical regions depend on a significance level, &alpha, of the test, and on the alternative hypothesis. The choice of α is arbitrary; in practice, the values of 0.1, 0.05, or 0.01 are most commonly used as α. Once we agree on the value of α, we can easily determine the critical regions of the Z-test:
To decide the fate of H₀, check whether or not your z falls in the critical region:
As you see, the formulae for the critical values of Z-tests involve the inverse, Φ⁻¹, of the cumulative distribution function (cdf) of N(0,1).
Our calculator reduces all the complicated steps:
If you want to find z based on p-value, please remember that in the case of two-tailed tests there are two possible values of z: one positive and one negative, and they are opposite numbers. This Z-test calculator returns the positive value in such a case. In order to find the other possible value of z for a given p-value, just take the number opposite to the value of z displayed by the calculator.
To make sure that you've fully understood the essence of Z-test, let's go through some examples:
Formally, the hypotheses that we set are the following:
We went to a shop and bought a sample of 9 bottles. After carefully measuring the volume of juice in each bottle, we've obtained the following sample (in milliliters): 1020, 970, 1000, 980, 1010, 930, 950, 980, 980.
As 0.0228 < 0.05, we conclude that our suspicions aren't groundless; at the most common significance level, 0.05, we would reject the producer's claim, H₀, and accept the alternative hypothesis, H₁.
In our sample we have 20 successes (denoted by ones) and 30 failures (denoted by zeros), so:
Since 0.1573 > 0.1 we don't have enough evidence to reject the claim that the coin is fair, even at such a large significance level as 0.1. In that case, you may safely toss it to your Witcher.
We use a t-test for testing the population mean of a normally distributed dataset which had an unknown population standard deviation. We get this by replacing the population standard deviation in the Z-test statistic formula by the sample standard deviation, which means that this new test statistic follows (provided that H₀ holds) the t-Student distribution with n-1 degrees of freedom instead of N(0,1).
For large samples, the t-Student distribution with n degrees of freedom approaches the N(0,1). Hence, as long as there are a sufficient number of data points (at least 30), it does not really matter whether you use the Z-test or the t-test, since the results will be almost identical. However, for small samples with unknown variance, remember to use the t-test instead of Z-test, because in such case the t-Student
To calculate the Z test statistic:
|