# Z-Test two sample for means in Excel using the QI Macros

### When to use the Z-Test two sample for means

- To compare population and sample means to determine if there is a significant difference.
- To compare means between two samples.
- To compare the mean of one sample to a given constant.

The Z-test is typically used in evaluating the results of standardized tests. Are the results from a sample of students outside of or within the standard test performance? Consider the following example taken from Statistical Analysis in Excel for Dummies by Joseph Schmuller.

### Example: New Training Technique Designed to Increase IQ

Imagine a new training technique designed to increase IQ. Take a sample of 25 people and train them using the new technique. Take another sample of 25 people and give them no special training.

Now, conduct a test with the two samples and input their scores into Excel:

Then, select the data with the mouse and click on the QI Macros Menu to select the Z-Test two sample for means test:

The QI Macros will prompt for a significance level (default = 0.05):

a hypothesized mean difference (in this case 0 ):

and variances for variables 1 and 2

The QI Macros Z-Test will perform the calculations and interpret the results for you:

**What's Cool About Z-Test Calculations in the QI Macros?**

**What's Cool About Z-Test Calculations in the QI Macros?**

When you run the Z-Test, the QI Macros will compare the p-value (0.192) to the significance level (0.05) and interpret the results for you. "Cannot Reject the Null Hypothesis because p > 0.05" and that the "Means are the same."

### Interpreting the Z-Test results manually

- The null hypothesis H0 is that the mean difference = 0

or in other words the means are the same

- The alternative hypothesis Ha is that the mean difference is > 0

or in other words that the mean of the trained population is larger

If |
Then |

test statistic > critical value (i.e. z> zcrit) |
Reject the null hypothesis |

test statistic < critical value (i.e. z< zcrit) |
Cannot Reject the null hypothesis |

p value < a | Reject the null hypothesis |

p value > a | Cannot Reject the null hypothesis |

Since the null hypothesis is that the means are the same this is a two-sided test. Therefore, use the two-tail values for your analysis.

Since the z statistic < zcritical (1.305 < 1.960) and p value > a ( 0.192> 0.05) , we cannot reject the null hypothesis that the means are the same.

### One-Sample Z-Test

*New*data above, use native Excel formulas in an empty cell:

=ztest(A1:A26,*100)*

Gives *p*=0.015

Since the p-value is < 0.05, we can reject the null hypothesis.