Use the two sample Z test macro available from our Macros Library to:
- Compare two population means when the variances are known.
- Test if the difference between the two population means is d or significantly different from d.
- Calculate a 1-alpha confidence interval for the difference in the observed means.
- Estimate these statistics from either stacked or unstacked data.
1. Click the link, Two Sample Z Test, below.
2. To the right of the Two sample Z Test description, click Code.
3. Save the page as a macro, called TwoZtest.MAC, in your Minitab macros directory (for example C:\Program Files\Minitab\Minitab 16\English\Macros). (For instructions, see How to save this page as a macro at the top of the Code page.)
For example, suppose you have stored in your worksheet the data in columns C1 and C2, corresponding to each one of your samples. To run the two sample Z test with a 95% confidence interval for the difference in the observed means, assuming the population standard deviations are 5 and 7.5 for the samples contained in C1 and C2 then:
In the Session window:
At the command prompt (MTB >) type %TWOZTEST C1 C2 5 7.5
Note: To display the command prompt, activate the Session window and choose Editor > Enable Commands.