The Wilcoxon rank-sum test is a non-parametric test used to compare two independent samples. In Matlab, you can perform the Wilcoxon rank-sum test using the ranksum
function.
The basic syntax of the ranksum
function is:
main.m27 chars2 lines
where x
and y
are the two independent samples, and p
is the p-value of the test, h
is the test decision (0 if the null hypothesis cannot be rejected and 1 if it can be rejected), and stats
is a structure containing additional statistical information.
Here's an example of how to use ranksum
in Matlab:
main.m406 chars15 lines
In this example, we generate two independent samples of data (with different means), and then perform the Wilcoxon rank-sum test using the ranksum
function. Finally, we display the p-value and the test decision.
gistlibby LogSnag