Two sample Z test

This macro performs a 2-sample Z test on either stacked or unstacked data stored in the active worksheet. The main difference between this test and a two sample t test is that the population standard deviations are assumed to be known for the 2-sample Z test.

This macro performs a 2-sample Z test on either stacked or unstacked data stored in the active worksheet. The main difference between this test and a two sample t test is that the population standard deviations are assumed to be known for the 2-sample Z test.

Download the Macro

Be sure that Minitab knows where to find your downloaded macro. Choose File > Options > General. Under Macro location browse to the location where you save macro files.

Important

If you use an older web browser, when you click the Download button, the file may open in Quicktime, which shares the .mac file extension with Minitab macros. To save the macro, right-click the Download button and choose Save target as.

Required Inputs

  • Either two columns of sample data (unstacked) or a single column of sample data and a corresponding column of group indicators (stacked)
  • The standard deviation for each group

Optional Inputs

ALPHA K
Use to specify an alpha level (K) other than the default of 0.05.
ALT K
Use to specify an upper or lower-tailed test instead of the default (Ho: mu1 - mu2 = 0). Use 1 as the argument for an upper-tailed test, -1 for a lower-tailed test.
DIFF K
Use to specify a test difference other than the default of 0.

Running the Macro

Suppose the data are unstacked and stored in C1 and C2 where the standard deviation for the first sample is 1 and for the second sample is 1.25.To run the macro, choose View > Command Line/History and type:

%TWOZTEST C1 C2 1 1.25

Click Run.

Suppose the data are stacked with the sample data in C1 and the group id's in C2, where the standard deviation for the first sample is 1 and for the second sample is 1.25.To run the macro, choose View > Command Line/History and type:

%TWOZTEST C1 1 1.25;
GRP C2.

Click Run.