# Two Sample Z test

-

The two sample Z test is used to check for the equality of means for two populations. The null hypothesis for our test is that the two population means are equal.

For example, suppose that there are two bulb manufacturers. We might be interested in knowing whether the mean life of bulbs produced by them are equal or not. We would apply the two sample Z test in such a situation.

### Procedure to carry out the two sample Z test:

1. Formulate the null hypothesis as H_0: \mu_1=\mu_2.
2. Depending on the situation formulate the alternative hypothesis H1 as: \mu_1\neq \mu_2 \text{ (Two sided alternative hypothesis)} \mu_1\geq \mu_2 \text{ or }\mu_1\leq \mu_2 \text{ (One sided alternative hypothesis)}
3. Decide the level of significance \alpha for the test. We usually take \alpha = 5\%
4. Calculate the value of the test statistic using the formula, \text{ Test Statistic Z} = \frac{|\bar{x_1}-\bar{x_2}|}{\sqrt{\frac{\sigma_1^2}{n_1} + \frac{\sigma_2^2}{n_2}}}
5. Find the Z table value – Z_\alpha for one sided test and Z_{\alpha/2} for two sided test.
6. If the value of the test statistic exceeds the table value we reject the null hypothesis and accept the alternative hypothesis.
7. If the value of the test statistic is less than the table value we accept the null hypothesis and conclude that the two population means are equal.

### Example of a two sample Z test:

A man buys 50 bulbs from company A and 50 bulbs from company B. The mean life of bulbs from company A is 1500 hours with a standard deviation of 60 and company B bulbs have an average life of 1512 hours with a standard deviation of 80. Is there a significant difference in the mean life of bulbs between the two companies? Take the level of significance to be 5%

Solution: We have the null hypothesis H_0: \mu_1=\mu_2 vs alternative hypothesis H_1: \mu_1\neq \mu_2

Given \bar{x_1}=1500, \bar{x_2}=1512, n_1=n_2=50, \sigma_1=60, \sigma_2=80

We calculate the value of the test statistic using the above formula,

\text{ Test Statistic Z} = \frac{|1500-1512|}{\sqrt{\frac{60^2}{50} + \frac{80^2}{50}} }= 0.849

And, Z table value = Zα/2 = Z0.025 = 1.96

Since the test statistic is less than the table value we accept the null hypothesis and conclude that the mean life of bulbs from the two companies are equal.

Hey 👋

I'm currently pursuing a Ph.D. in Maths. Prior to this, I completed my master's in Maths & bachelors in Statistics.

I created this website for explaining maths and statistics concepts in the simplest possible manner.

If you've found value from reading my content, feel free to support me in even the smallest way you can.

### Advantages and Disadvantages of Action Research

#### Popular categories

Previous articlePower Rule in Calculus
Next articleOne sample Z test