Wilcoxon
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...)
Syntax: STATS=WILCOXON(X1,X2,PLTS)
Inputs:
X1 and X2 - data vectors.
ALPHA - significance level (default = 0.05).
PLTS - Flag to set if you don't want (0) or want (1) view the plots
Outputs:
- W value and p-value when exact ranks distribution is used.
- W value, Z value, Standard deviation (Mean=0), p-value when normal distribution is used
If STATS nargout was specified the results will be stored in the STATS
struct.
Example:
X1=[77 79 79 80 80 81 81 81 81 82 82 82 82 83 83 84 84 84 84 85 85 86 86 87 87];
X2=[82 82 83 84 84 85 85 86 86 86 86 86 86 86 86 86 87 87 87 88 88 88 89 90 90];
Calling on Matlab the function: wilcoxon(X1,X2)
Answer is:
WILCOXON TEST
Mean_of_differences Confidence_interval
___________________ ___________________
Binomial_estimator 3 3 4
Hodges_Lehmann_estimator 3.5 3 4
Sample size is good enough to use the normal distribution approximation
W Mean SD Z p_value_two_tails
___ ____ ______ ______ _________________
325 0 73.161 4.4354 9.1886e-06
Created by Giuseppe Cardillo
giuseppe.cardillo-edta@poste.it
To cite this file, this would be an appropriate format:
Cardillo G. (2006). Wilcoxon test: non parametric Wilcoxon test for paired samples.
http://www.mathworks.com/matlabcentral/fileexchange/12702
Cite As
Giuseppe Cardillo (2024). Wilcoxon (https://github.com/dnafinder/wilcoxon), GitHub. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Versions that use the GitHub default branch cannot be downloaded
Version | Published | Release Notes | |
---|---|---|---|
2.0.0.0 | inputparser; table implementation; some minor bugs correction; github link |
|
|
1.10.0.0 | bug correction in normal approximation p-value |
||
1.9.0.0 | the Hodges-Lehmann estimator of median of differences was added |
||
1.8.0.0 | I added the plts flag to choose to show the plots |
||
1.7.0.0 | Changes in description |
||
1.6.0.0 | Changes in help and description sections |
||
1.5.0.0 | the STATS struct nargout was added |
||
1.4.0.0 | The output and the error handling were changed |
||
1.3.0.0 | bug correction |
||
1.2.0.0 | Little correction in help section to allow a correct copy and paste of the example. Correction in exitus subroutine. |
||
1.1.0.0 | Changes in help section |
||
1.0.0.0 | Improvement in input error handling |