4.0

4.0 | 1 rating Rate this file 197 downloads (last 30 days) File Size: 2.72 KB File ID: #12702

Wilcoxon test

by Giuseppe Cardillo

 

19 Oct 2006 (Updated 16 Nov 2009)

Code covered by BSD License  

non parametric Wilcoxon test for two paired samples

Download Now | Watch this File

File Information
Description

This file execute the non parametric Wilcoxon test to evaluate the difference between paired (dependent) samples. If the number of difference is less than 15, the algorithm calculate the exact ranks distribution; else it uses a normal distribution approximation.
Now, the MatLab function SIGNRANK returns the same p-value. Anyway, this Wilcoxon function gives a more detailed output (that is necessary for publications...)

Required Products Statistics Toolbox
MATLAB release MATLAB 7.1.0 (R14SP3)
Zip File Content  
Other Files license.txt,
wilcoxon.m
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (9)
20 Oct 2006 Jos x@y.z

As this requires the statistics toolbox, the function RANKSUM and SIGNRANK are available to the users. What does this function adds to those two?

20 Oct 2006 Giuseppe Cardillo

RANKSUM and SIGNRANK don't compute the correction for the ties.

20 Oct 2006 Giuseppe Cardillo

ERRATA CORRIGE: the TIEADJ value computed by TIEDRANK is quite different from correction reported in several books. The same for z-value because W is approximated with a normal distribution with mean=0 and std.dev=1. In this algorithm the tie correction is computed as reported in Stanton A. Glantz book and the normal distribution has mean=0 and a calculated std.dev (depending on tie correction).

24 Oct 2006 Brahim HAMADICHAREF

Good but code need line 57

if min(rowx, colx) > 1 || min(rowy,coly) > 1,

to be replaced with

if((min(rowx1, colx1) > 1) || (min(rowx2,colx2) > 1))

Brahim

25 Oct 2006 Giuseppe Cardillo

You have right. I fixed the bug and uploaded the new file.

08 Jun 2007 James Cai

If my vectors, X and Y, are different in length, can I use wilcoxon(X,Y)? If not, what's the solution? Thanks.

12 Jun 2007 Giuseppe Cardillo

The Wilcoxon's test is a paired test. Infact it test if the differences observed in a group after an event (in exemplum drug subministration) are caused by the event or by chance. If your vectors differ in length you must delete the uncoupled data. I think there isn't any other solutions.

05 Mar 2008 Antonio Trujillo-Ortiz

Hi Giuseppe,

You are wrong. According to the non-parametric statistics theoretic fundamentals, there are a two Wilcoxon tests:(1)Wilcoxon Rank Test for two unpaired samples, and(2) Wilcoxon Sign-Rank Test for two paired samples. You must to review them.

Yours,

Prof. Antonio Trujillo-Ortiz

07 Mar 2008 Antonio Trujillo-Ortiz

Only to correct and clarify my previous comment, and to recall to all that, with respect to the non parametric tests between two samples, two classes exist: (1) Independent, that can be both of the same size or not, being been able to utilize the Mann-Whitney’s test or the Wilcoxon ranks test; and (2) Dependent, that necessarily them should be of the same size, since is the same sample observed in two different circumstances or times, where applies the Wilcoxon signs and ranks test.

Also, I should clarify that in the personal thing I do not use the term unpaired to assign independent samples, since unpaired is synonym of unbalanced; neither paired for assign dependent, since paired is synonym of balanced. This by the fundamental reason that the concepts of independent or dependent arise for the itself nature of the data, and not because they are unpaired or paired.

The m-file here developed by Giuseppe it is a Wilcoxon’s test for two dependent samples for it is correct his comment that the data vectors must have the same length, and, if it is not, delete those uncoupled data. There isn't any other solutions.

So, my previous review comment is obsolete and should be ignored.

Thanks,

Prof. Antonio Trujillo-Ortiz

Please login to add a comment or rating.
Updates
23 Oct 2006

m-lint and errors handling improvement

23 Oct 2006

fix in errors messages

23 Oct 2006

improvement

25 Oct 2006

fix bug

30 Oct 2006

Error handling and calculation improvements

10 Mar 2008

Change in DEscription according to Antonio Trujillo-Ortiz comment

24 Sep 2008

Improvement in input error handling

12 Nov 2008

Changes in help section

23 Mar 2009

Little correction in help section to allow a correct copy and paste of the example. Correction in exitus subroutine.

06 Nov 2009

bug correction

11 Nov 2009

The output and the error handling were changed

13 Nov 2009

the STATS struct nargout was added

16 Nov 2009

Changes in help and description sections

Tag Activity for this File
Tag Applied By Date/Time
statistics Giuseppe Cardillo 22 Oct 2008 08:44:31
probability Giuseppe Cardillo 22 Oct 2008 08:44:31
wilcoxon Giuseppe Cardillo 22 Oct 2008 08:44:32
paired samples Giuseppe Cardillo 22 Oct 2008 08:44:32
parametric Giuseppe Cardillo 22 Oct 2008 08:44:32
statistics Cristina McIntire 12 Nov 2008 13:56:23
probability Cristina McIntire 12 Nov 2008 13:56:23
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com