Introduction to Nonparametric Analysis


Comparing Two Related Samples

SAS/STAT software provides the following nonparametric tests for comparing the locations of two related samples:

  • Wilcoxon signed rank test

  • sign test

  • McNemar’s test

The first two tests are available in the UNIVARIATE procedure, and the last test is available in the FREQ procedure. When you perform these tests, your data should consist of pairs of measurements for a random sample from a single population. For example, suppose your data consist of SAT scores for students before and after attending a course on how to prepare for the SAT. The pairs of measurements are the scores before and after the course, and the students should be a random sample of students who attended the course. Your goal in analysis is to decide whether the median change in scores is significantly different from zero.

Tests in the UNIVARIATE Procedure

By default, PROC UNIVARIATE performs a Wilcoxon signed rank test and a sign test. To use these tests on two related samples, perform the following steps:

  1. In the DATA step, create a new variable that contains the differences between the two related variables.

  2. Run PROC UNIVARIATE, using the new variable in the VAR statement.

See the chapter "The UNIVARIATE Procedure" in the Base SAS Procedures Guide for details and examples of these tests.

Tests in the FREQ Procedure

The FREQ procedure can be used to obtain McNemar’s test, which is simply another special case of a Cochran-Mantel-Haenszel statistic (and also of the sign test). The AGREE option in the TABLES statement produces this test for $2 \times 2$ tables, and exact p-values are also available for this test. See Chapter 40: The FREQ Procedure, for more information.