This section describes tests appropriate for two independent samples (for example, two groups of subjects given different
SAS/STAT software provides several nonparametric tests for location and scale differences.
When you perform these tests, your data should consist of a random sample of observations from two different populations. Your goal is either to compare the location parameters (medians) or the scale parameters of the two populations. For example, suppose your data consist of the number of days in the hospital for two groups of patients: those who received a standard surgical procedure and those who received a new, experimental surgical procedure. These patients are a random sample from the population of
The NPAR1WAY procedure provides the following location tests: Wilcoxon rank sum test (Mann-Whitney U test), Median test, Savage test, and Van der Waerden test. Also note that the Wilcoxon rank sum test can be obtained from the FREQ procedure. In addition, PROC NPAR1WAY produces the following tests for scale differences: Siegel-Tukey test, Ansari-Bradley test, Klotz test, and Mood test. PROC NPAR1WAY also provides tests using the input data observations as scores, enabling you to produce a wide variety of tests. You can construct any scores with the DATA step, and then PROC NPAR1WAY computes the corresponding linear rank test. You can also directly analyze the raw data this way, producing the permutation test known as Pitman's test.
When data are sparse, skewed, or heavily tied, the usual
Chapter 52, 'The NPAR1WAY Procedure,' provides detailed statistical formulas for these statistics, as well as examples of their use.
This procedure provides a test for comparing the location of two groups and for testing for independence between two
The situation in which you want to compare the location of two groups of observations corresponds to a table with two rows. In this case, the asymptotic Wilcoxon rank sum test can be obtained by using SCORES=RANK in the TABLES statement and by looking at either of the following:
the Mantel-Haenszel statistic in the list of tests for no association. This is labeled as 'Mantel Haenszel Chi-Square' and PROC FREQ displays the statistic, the degrees of freedom, and the p -value. To obtain this statistic, specify the CHISQ option in the TABLES statement.
the CMH statistic 2 in the section on Cochran-Mantel-Haenszel statistics. PROC FREQ displays the statistic, the degrees of freedom, and the p -value. To obtain this statistic, specify the CMH2 option in the TABLES statement.
When you test for independence, the question being
For testing whether two variables are independent, PROC FREQ provides Fisher's exact test. For a 2 — 2 table, PROC FREQ automatically provides Fisher's exact test when you specify the CHISQ option in the TABLES statement. For a 2 — c table, use the FISHER option in the EXACT statement to obtain the test.
See Chapter 29, 'The FREQ Procedure,' for details, formulas, and examples of these tests.
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
By default, PROC UNIVARIATE
In the DATA step, create a new variable that contains the differences between the two related variables.
Run PROC UNIVARIATE, using the new variable in the VAR statement.
For discussion of the tests, formulas, and examples, refer to the chapter on the UNIVARIATE procedure in the Base SAS 9.1 Procedures Guide .
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 — 2 tables, and exact p -values are also available for this test. See Chapter 29, 'The FREQ Procedure,' for more information.