turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- JMP User Community
- :
- Discussions
- :
- Discussions
- :
- Wilcoxon Signed-Rank Test

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

May 20, 2010 2:47 PM
(5241 views)

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?

Thanks for the help in advance.

Thanks for the help in advance.

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

As stated above,

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.

Is that okay?

Duane Hayes

9 REPLIES

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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:

http://en.wikipedia.org/wiki/Wilcoxon_signed-rank_test

http://en.wikipedia.org/wiki/Mann-Whitney-Wilcoxon_test

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

http://en.wikipedia.org/wiki/Wilcoxon_signed-rank_test

http://en.wikipedia.org/wiki/Mann-Whitney-Wilcoxon_test

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Here is an example with sample data from UCLA Stat Academic Tech Services that agrees:

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Thank you both for the feedback.

David Q/R I was using a book example which is why I was so surprised to get different answers.

Is there any way to get the source code to work through the problem by hand and see at which step the code may do differently?

Thanks again.

David Q/R I was using a book example which is why I was so surprised to get different answers.

Is there any way to get the source code to work through the problem by hand and see at which step the code may do differently?

Thanks again.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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?):

http://udel.edu/~mcdonald/statsignedrank.html

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.

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?):

http://udel.edu/~mcdonald/statsignedrank.html

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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 typea typeb;

diff= typea-typeb;

cards;

211.40000000000001000 186.30000000000001000

204.40000000000001000 205.69999999999999000

202.00000000000000000 184.40000000000001000

201.90000000000001000 203.59999999999999000

202.40000000000001000 180.40000000000001000

202.00000000000000000 202.00000000000000000

202.40000000000001000 181.50000000000000000

207.09999999999999000 186.69999999999999000

203.59999999999999000 205.69999999999999000

216.00000000000000000 189.09999999999999000

208.90000000000001000 183.59999999999999000

208.69999999999999000 188.69999999999999000

213.80000000000001000 188.59999999999999000

201.59999999999999000 204.19999999999999000

201.80000000000001000 181.59999999999999000

200.30000000000001000 208.69999999999999000

201.80000000000001000 181.50000000000000000

201.50000000000000000 208.69999999999999000

212.09999999999999000 186.80000000000001000

203.40000000000001000 182.90000000000001000

;

proc univariate;

var diff;

run;

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;

data fertilizer;

input typea typeb;

diff= typea-typeb;

cards;

211.40000000000001000 186.30000000000001000

204.40000000000001000 205.69999999999999000

202.00000000000000000 184.40000000000001000

201.90000000000001000 203.59999999999999000

202.40000000000001000 180.40000000000001000

202.00000000000000000 202.00000000000000000

202.40000000000001000 181.50000000000000000

207.09999999999999000 186.69999999999999000

203.59999999999999000 205.69999999999999000

216.00000000000000000 189.09999999999999000

208.90000000000001000 183.59999999999999000

208.69999999999999000 188.69999999999999000

213.80000000000001000 188.59999999999999000

201.59999999999999000 204.19999999999999000

201.80000000000001000 181.59999999999999000

200.30000000000001000 208.69999999999999000

201.80000000000001000 181.50000000000000000

201.50000000000000000 208.69999999999999000

212.09999999999999000 186.80000000000001000

203.40000000000001000 182.90000000000001000

;

proc univariate;

var diff;

run;

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;

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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.

Is that okay?

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.

Is that okay?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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.

Michael

Michael

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Thank you all again for your help. I have been able to get the solutions to match.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

As stated above,

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.

Is that okay?

Duane Hayes