What Is a Z-Test?
Let me explain what a Z-test is: it's a hypothesis test that helps you gauge the average daily return of a stock, for instance. Essentially, a Z-test compares one mean against a hypothesized value or tests whether two means are the same. For it to work properly, your data must approximately fit a normal distribution; otherwise, the test won't be reliable. When you're performing a Z-test, you need to calculate parameters like variance and standard deviation.
Key Takeaways
Here's what you need to know: a Z-test is a hypothesis test for data that follows a normal distribution. The result comes as a Z-statistic or Z-score. Z-tests are closely related to T-tests, but you should use T-tests when your experiment has a small sample size. Remember, Z-tests assume the standard deviation is known, while T-tests assume it's unknown.
Hypothesis Testing
The Z-test falls under hypothesis testing, where the Z-statistic follows a normal distribution. You should use the Z-test for samples greater than 30 because, according to the central limit theorem, larger samples are approximately normally distributed. For the Z-test to be effective, the population must be normally distributed, and samples must have the same variance. All data points need to be independent.
When you conduct a Z-test, state the null and alternative hypotheses along with the alpha level. Calculate the Z-score, and the results will show how many standard deviations above or below the population mean your score is.
You can conduct various tests as Z-tests, such as a one-sample location test, a two-sample location test, a paired difference test, and a maximum likelihood estimate. Again, Z-tests are similar to T-tests, but T-tests are better for small samples. T-tests assume unknown standard deviation, while Z-tests assume it's known. If the population standard deviation is unknown, we assume the sample variance equals the population variance.
Formula for Z-Score
The Z-score is calculated using this formula: z = (x - μ) / σ, where z is the Z-score, x is the value being evaluated, μ is the mean, and σ is the standard deviation.
One-Sample Z-Test Example
Suppose you, as an investor, want to test if the average daily return of a stock is greater than 3%. You take a random sample of 50 returns, and the average is 2%. Assume the standard deviation of the returns is 2.5%. So, the null hypothesis is that the mean equals 3%.
The alternative hypothesis is that the mean is greater or less than 3%. Let's assume an alpha of 0.05% with a two-tailed test. That means 0.025% in each tail, and the critical values are 1.96 or -1.96. If Z is greater than 1.96 or less than -1.96, reject the null hypothesis.
To calculate Z, subtract the hypothesized average (3%) from the observed average (2%), then divide by the standard deviation divided by the square root of the sample size. So, the test statistic is (0.02 - 0.03) ÷ (0.025 ÷ √50) = -2.83.
Since -2.83 is less than -1.96, you reject the null hypothesis and conclude the average daily return is less than 3%.
What's the Difference Between a T-Test and Z-Test?
T-tests are best when your data has a small sample size, like less than 30. They assume the standard deviation is unknown, whereas Z-tests assume it's known.
When Should You Use a Z-Test?
Use a Z-test if the population standard deviation is known and the sample size is 30 or larger. If the population standard deviation is unknown, regardless of sample size, go with a T-test instead.
What Is Central Limit Theorem (CLT)?
In probability theory, the central limit theorem (CLT) states that the distribution of a sample approximates a normal distribution as the sample size gets larger, assuming samples are identical in size, no matter the population's distribution shape. Samples of 30 or more are usually sufficient for the CLT to hold, which is why Z-tests rely on it for accuracy.
The Bottom Line
A Z-test is used in hypothesis testing to check if a finding is statistically significant, especially to see if two means are the same. You can only use it if the population standard deviation is known and the sample size is 30 or larger; otherwise, employ a T-test.





