When I run the Wilcoxon Signed-Rank option in JMP I am getting very different answers from what I am getting in SAS. Is there a way to get the code that is used in each option (SAS and JMP) or the formulas used to figure out why the results are different?
It's highly likely that one of them has simply been set up incorrectly, so the best thing to do first would be to get hold of a textbook example and run that data through both your SAS and JMP analyses to find out which one isn't producing the results you'd expect. My personal favourite in terms of easy-to-follow examples is "Nonparametric Statistics for the Behavioural Sciences" by Sidney Siegel, but there are plenty of others.
My second thought would be that maybe either the SAS or the JMP test you're performing isn't actually the signed-rank test for paired samples but the rank sum test for independent samples (sometimes known as the Mann-Whitney U test). The two tests are nonparametric analogues of the paired and unpaired t-tests respectively, and Wilcoxon's name is associated with both of them: details of both can be found in Wikipedia, together with worked examples, at the following links:
If there's a way to get at the actual source code I've no idea what it might be, I'm afraid - but I've just taken a quick look at the Wilcoxon Test referred to in MattF's post above in both SAS and JMP, and both of them look as if they're running a Mann-Whitney-Wilcoxon test on the difference between data pairs, indicating that you've effectively got to calculate the difference between the pairs yourself before running a one-way comparison on that set of differences. Are you actually doing that?
Below is another reference showing how to perform a Wilcoxon Matched-Pairs Signed-Ranks test in SAS, suggesting that the basic test is not actually one of those supplied as a simple procedure (or why go to the trouble of doing it in this slightly roundabout way?):
If you'd like to post a copy of the code you're running I'll be happy to check to see if I'm right about this.
Thanks so much David. It does look like it will be tricky for me to nail down how SAS actually does their calculating (especially in the JMP world). Below is the code I have used for SAS. I did the calculation two ways, once using proc univariate and once using npar1way.
data fertilizer; input type $ fert; cards; a 211.40000000000001000 b 186.30000000000001000 a 204.40000000000001000 b 205.69999999999999000 a 202.00000000000000000 b 184.40000000000001000 a 201.90000000000001000 b 203.59999999999999000 a 202.40000000000001000 b 180.40000000000001000 a 202.00000000000000000 b 202.00000000000000000 a 202.40000000000001000 b 181.50000000000000000 a 207.09999999999999000 b 186.69999999999999000 a 203.59999999999999000 b 205.69999999999999000 a 216.00000000000000000 b 189.09999999999999000 a 208.90000000000001000 b 183.59999999999999000 a 208.69999999999999000 b 188.69999999999999000 a 213.80000000000001000 b 188.59999999999999000 a 201.59999999999999000 b 204.19999999999999000 a 201.80000000000001000 b 181.59999999999999000 a 200.30000000000001000 b 208.69999999999999000 a 201.80000000000001000 b 181.50000000000000000 a 201.50000000000000000 b 208.69999999999999000 a 212.09999999999999000 b 186.80000000000001000 a 203.40000000000001000 b 182.90000000000001000 ;
proc npar1way wilcoxon; class type; var fert; run;
Hello again - I've set up below some SAS code to do the analysis as per the description in the earlier references, and then run the same analysis through JMP...
To do the same thing in JMP, download the following note by James Abbey at www.personal.psu.edu/jda188/JMP/Signedrank.doc and follow the instructions there on the DIFF column of your data set.
That is, import either FERTILIZER1.SAS7BDAT or FERTILIZER3.SAS7BDAT from your WILC library into JMP, and analyze the DIFF column using Analyze | Distribution. Copy the DIFF column into the "Y, Columns" placeholder and click OK. Next, click on the second red triangle and select "Test Mean". Put 0 into "Specify Hypothesized Mean", and check the "Wilcoxon Signed Rank" box, then click OK. In the "Test Mean=value" section of the output you should find the test statistic = 74, and the P value of 0.0017 - which is the same answer as the one that SAS produces.
If the JMP table is arranged so that you have two columns corresponding to the two treatments, each row being a matched pair, then you can also use the Matched Pairs platform to directly get the Wilcoxon Signed Rank test (from the red triangle pull down menu) without calculating the differences. It agrees with the results based on the differences in Distribution.