Wilcoxon Signed-Rank with SAS

  1. The Wilcoxon signed-rank test
  2. Example: analyze the data with Wilcoxon signed-rank test
  3. Output and interpretation

The Wilcoxon signed-rank test

A common experiment design is to have a test and control conditions. A two sample t-test would have been a good choice if the test and control groups are independent and follow Normal distribution. If conditions are not met, nonparametric test methods are needed. This section covers one such test, called Wilcoxon signed-rank test (equivalent to the Mann-Whiney U-test) for two samples. The test is preferred when:

  1. Compare the difference between two means to zero (Ho: &mu of the difference = 0).
  2. The two groups of data are dependent.
  3. The type of variable could be continuous or ordinal.
  4. The data might not be normally distributed.

Analyzing the data with Wilcoxon signed-rank test

Consider the following example. For each of the 9 horses, a veterinary anatomist measured the density of nerve cells at specified sites in the intestine. The results for site I (mid region of jejunum) and site II (mesenteric region of jejunum) are measured. Each density value is the average of counts of nerve cells in 5 equal sections of tissue. The question is to test whether the densities of two sites are different.

The data is "horse.csv".

The data of two sites (of the same horse) are dependent, futher analysis (ignored) also shown that the data are not normally distributed. Therefore, a Wilcoxon signed-rank test is recommended.

Open the data set from SAS. Or import with the following command.

   data horse;
	infile "H:\sas\data\horse.csv" dlm=',' firstobs=2;
	input house site1 site2;

A new column "diff" = "site1"-"site2" needs to be created first, and then proc univariate is run with the following commends.

   data horse2;
	set  horse;
	diff= site1-site2;

    proc univariate data=horse2;
	  var diff;

The key output and intepretation

           Nonparametric test to compare respiration between growth and gap area            

                                    The UNIVARIATE Procedure
                                         Variable:  diff

                                      Tests for Location: Mu0=0

                        Test           -Statistic-    -----p Value------

                        Student's t    t  2.823066    Pr > |t|    0.0224
                        Sign           M       1.5    Pr >= |M|   0.5078
                        Signed Rank    S      16.5    Pr >= |S|   0.0547

The SAS procedure "univariate" performs 3 tests, student's t, sign and Wilcoxon signed-rank test. Results are shown in the "Tests for Location" table. According to the p-value of the "(Wilcoxon) Signed Rank", 0.0547. The test is not rejectd at a &alpha level of 0.05. Note that the intepretations are quite different if chosen other test: student's t or sign test.

The student's t is not appropriate since the Normal distribtuion assumption is not met. Furthermore, if sign test is used, the question is to test the hypothesis that the difference between two sites are equally positive or negative . Since the sign test has p-value of 0.5078 and one should not reject the null hypothesis. However, just because the there are equally positives and negatives doesn't mean the mean is zero. For example, the following two samples have same number of positve and negative differences. But the mean of the first sample is obviously bigger than the second, suggesting the population mean difference, &mu1 is greater than &mu2.

		Sample 1	Sample 2	Difference 	Sign
		100		10		90		+
		150		25		125		+
		60		61		-1		-
		46		50		-4		-