Two sample Z test of proportions is the test to determine whether the two populations differ significantly on specific characteristics. In other words, compare the proportion of two different populations that have some single characteristic. It calculates the range of values that is likely to include the difference between the population proportions.

For example, compare the proportion of men baseball players who are right-handed to the proportion of women baseball players who are right-handed.

## When to use Two Sample Z Proportion test

The purpose of two sample Z test is to compare the random samples of two populations. Use two sample z test of proportion for large sample size and Fisher exact probability test is an excellent non-parametric test for small sample sizes.

## Assumptions of the Two Sample Z Proportion Hypothesis Tests

- The data are simple random values from both the populations
- Both populations follow a binomial distribution
- Samples are independent of each other
- Test results are accurate when np and n(1-p) are greater than 5

## Hypothesis of two sample Z proportion test

- Null hypothesis: The difference between population proportions is equal to hypothesized difference
- Alternative hypothesis: The difference between population proportions is not equal to hypothesized difference (two -tailed)
- The difference between population proportions is greater than hypothesized difference (right-tailed)
- The difference between population proportions is less than hypothesized difference (left -tailed)

## Two Sample Z Test of Proportions Variations

There are 2 ways to compute the two sample Z test of proportions i.e pooled or unpooled.

#### Pooled Z test of proportions formula

#### Un-pooled Z test of proportions formula

### Procedure to execute Two Sample Proportion Hypothesis Test

- State the null hypothesis and alternative hypothesis
- State alpha, in other words determine the significance level
- Compute the test statistic
- Determine the critical value (from critical value table)
- Define the rejection criteria
- Finally, interpret the result. If the test statistic falls in critical region, reject the null hypothesis

## Two Sample Z Test of Proportions Pooled (ASQ, Villanova)

Where

- z is test statistic
- p̂
_{1 }and p̂_{2}are observed proportion of events in the two samples - n1 and n2 are sample sizes
- X
_{1}and X_{2}are number of trails

### Example of Two Sample Z Proportion Test (pooled)

**Example: **A car manufacturer aims to improve the quality of the products by reducing the defects and also increase the customer satisfaction. Therefore, he monitors the efficiency of two assembly lines in the shop floor. In line A there are 18 defects reported out of 200 samples. While the line B shows 25 defects out of 600 cars. At α 5%, is the differences between two assembly procedures are significant?

Define Null and Alternative hypothesis

- Null Hypothesis: Two proportions are the same
- Alternative Hypothesis: Two proportions are not the same

α=0.05

State decision rule

Critical value is ±1.96, hence reject the null hypothesis if the calculated value is less than -1.96 or greater than +1.96

Calculate Test Statistic

- Line A= p̂
_{1=}18/200= 0.09 = 9% - Line B= p̂
_{2=}25/600 = 0.0416 = 4.16%

- First compute p
_{0}= 18+25/200+600=43/800=0.0537 =5.37%

- Now p̂
_{1}– p̂_{2}= 0.09 – 0.0416 = 0.0484 - p
_{0}* (1 – p_{0}) = 0.0537 * (1-0.0537) = 0.0537 * 0.9463 = 0.0508 - And (1/n1) + (1/n2) = 0.006667

- So, Z = (0.0484)/ SQRT ( (0.0508) * (0.006667))
- Z = (0.0484)/ SQRT ( 0.000339)) = (0.0484)/ (0.018406) = 2.62

**Interpret the results**: Compare Z_{calc} to Z_{critical }. In hypothesis testing, a critical value is a point on the test distribution compares to the test statistic to determine whether to reject the null hypothesis. Calculated test statistic value 2.62 and it is in critical region, hence reject the null hypothesis, so, there is a significant difference in two line assembly procedures.

### Pooled Z test of proportions formula template

**B: ** The null hypothesis for both one tail and two tail test p_{1} always equal to p_{2} .