| Statistics Toolbox | Search  Help Desk |
| signrank | Examples See Also |
Wilcoxon signed rank test of equality of medians.
Syntax
p = signrank(x,y,alpha)[p,h] = signrank(x,y,alpha)
Description
p = signrank(x,y,alpha) returns the significance probability that the medians of two matched samples, x and y, are equal. x and y must be vectors of equal length. alpha is the desired level of significance, and must be a scalar between zero and one.
[p,h] = signrank(x,y,alpha) also returns the result of the hypothesis test, h. h is zero if the difference in medians of x and y is not significantly different from zero. h is one if the two medians are significantly different.
p is the probability of observing a result equally or more extreme than the one using the data (x and y) if the null hypothesis is true. p is calculated using the rank values for the differences between corresponding elements in x and y. If p is near zero, this casts doubt on this hypothesis.
Example
This example tests the hypothesis of equality of means for two samples generated withnormrnd. The samples have the same theoretical mean but different standard deviations.
x = normrnd(0,1,20,1);
y = normrnd(0,2,20,1);
[p,h] = signrank(x,y,0.05)
p =
0.2568
h =
0
See Also
ranksum, signtest, ttest