What is Z-Test in statistics?
A z-test is a statistical test used to determine whether two population means are different when the variances are known and the sample size is large. A z-test can be performed only when the sample size is greater than 30 and the standard deviation of the population is known.
Steps involved to perform a z-test:
1. Define Null and Alternative hypotheses
2. Define decision rule based on critical value from the z table
3. Calculate the z score
4. Make the final decision based on the critical value and the calculated z score
Z score:
A z score is the unit/value which tells how far the observation is away from the sample mean in terms of standard deviation.
A z score is calculated by using the below formula
Finding the critical value with the help of the Z-table:
The z-table is short for the “Standard Normal z-table”. The Standard Normal model is used in hypothesis testing, including tests on proportions and on the difference between two means. The area under the whole of a normal distribution curve is 1, or 100 percent. The z-table helps by telling us what percentage is under the curve at any particular point.
You can check the critical value with the help of the z table from the below link
For example a z(0.6736) = 0.4 + 0.05 = 0.45
Solved problem:
Q) The average weight of the citizens of a city is 72kg with a standard deviation of 4. A sample of 36 people has been picked with a mean value of 74kg. Define the null hypothesis and prove if at a 95% confidence interval there is enough evidence to support it or not.
The null and alternate hypotheses can be defined as
H0 = Average weight of the citizens of the city is 72 kgs.
H1 = Average weight of the citizens of the city is not equal to 72 kgs.
We can reject the null hypothesis as the calculated z score value is greater than the critical value which means that the average weight of the citizens of the city is not equal to 72 kgs.
We can also arrive at the same conclusion with the help of the p-value. The area under the curve is found from the z table using the z score. The final decision is made by comparing the p-value with the significance value and reject H0 if p<= α and we fail to reject H0 if p > α
Application of z score:
- It is used in standardization to scale down the features (using sklearn StandardScaler library).
- It is used to compare the scores between different distributions.