Z-Test
Z-Test
-
For Population Proportion:
You can use the Z test to test hypotheses about population proportions. For example, you can test if the proportion of a certain category in one population differs from that in another. -
For Comparing Two Means:
You can compare two sample means to determine whether they come from populations with the same mean. For example, the Z test can be used to check if the average height in two groups is the same.
Key Assumptions
- The data should be approximately normally distributed, especially for large samples (central limit theorem).
- You should have a sufficiently large sample size (typically for each group).
- You should know the population variance or approximate it when the sample size is large.
Z-Test Formula for Comparing Means
For a Z test comparing two sample means, the formula is:
Where:
- and are the sample means,
- and are the sample sizes,
- and are the population standard deviations (or sample standard deviations for large samples).
Example
You want to compare the average heights of male and female students at a school. You take a random sample of 50 male students and 50 female students. The average height of the males in your sample is 175 cm with a standard deviation of 10 cm, and the average height of the females is 165 cm with a standard deviation of 8 cm. You want to test whether the average heights of males and females are the same.
Null Hypothesis ()
The mean height of males and females is equal, i.e., .
Test Statistic Formula
Where:
- = mean height of males = 175 cm,
- = mean height of females = 165 cm,
- = standard deviation of male heights = 10 cm,
- = standard deviation of female heights = 8 cm,
- .
Calculation
Since the Z-value is quite large, you would reject the null hypothesis and conclude that there is a significant difference between the average heights of male and female students.
Z-Test Formula for Population Proportion
For a Z test involving proportions, the formula is:
Where:
- and are the sample proportions,
- and are the sample sizes,
- is the pooled proportion, calculated as:
where and are the number of successes in each sample.
Example
A factory produces light bulbs, and it claims that 95% of its products meet quality standards. You take a random sample of 100 light bulbs and find that 90 of them meet the standards. You want to test whether the actual proportion of quality light bulbs is 95% as the factory claims.
Null Hypothesis ()
The proportion of quality light bulbs is 95%, i.e., .
Test Statistic Formula
Where:
- = sample proportion = ,
- = population proportion (claimed value) = 0.95,
- = sample size = 100.
Calculation
You would then compare this Z-value to the critical value from the Z-distribution to determine whether to reject the null hypothesis. If the Z-value is beyond the critical value for a given significance level (e.g., 1.96 for a 95% confidence level), you reject the null hypothesis.
When to Use a Z Test
- Large sample sizes (typically ).
- When the population variance is known or can be approximated.
- When you are comparing sample means or proportions and you want to test for significant differences.
If the sample size is small, and the population variance is unknown, a t-test is usually more appropriate.