| Statistics Toolbox | ![]() |
Wilcoxon signed rank test for zero median
Syntax
p = signrank(x) p = signrank(x,m) p = signrank(x,y) [p,h] = signrank(...) [p,h] = signrank(...,alpha) [p,h,stats] = signrank(...)
Description
p = signrank(x)
performs a two-sided signed rank test of the hypothesis that the data in the vector x come from a distribution whose median (and mean, if it exists) is zero, and returns the p-value from the test. p is the probability of observing the given result x, or one more extreme, by chance if the null hypothesis is true, i.e., the median is zero. Small values of p cast doubt on the validity of the null hypothesis. The data are assumed to come from a continuous distribution, symmetric about its median.
p = signrank(x,m)
performs a two-sided test of the hypothesis that the data in the vector x come from a distribution whose median is m. m must be a scalar.
p = signrank(x,y)
performs a paired, two-sided test of the hypothesis that the difference between the matched samples in the vectors x and y comes from a distribution whose median is zero. The differences x-y are assumed to come from a continuous distribution, symmetric about its median. x and y must be the same length.
Note
A hypothesis of zero median for x-y is not equivalent to a hypothesis of equal median for x and y. The signrank function tests the former, not the latter.
|
[p,h] = signrank(...)
returns the result of the hypothesis test, performed at the 0.05 significance level, in h. If h = 0, then the null hypothesis, i.e., the median is zero, cannot be rejected at the 5% level. If h = 1, then the null hypothesis can be rejected at the 5% level.
[p,h] = signrank(...,alpha)
returns the result of the hypothesis test performed at the significance level alpha.
[p,h,stats] = signrank(...)
returns stats, a structure with one or two fields. The field 'signedrank' contains the value of the signed rank statistic. If the sample size is large, then p is calculated using a normal approximation and the field 'zval' contains the value of the normal (Z) statistic.
Example
This example tests the hypothesis of zero median for the difference between two paired samples. The difference between the before and after samples has a symmetric distribution with zero median.
before = lognrnd(2,.25,10,1); after = before + trnd(2,10,1); [p,h] = signrank(before,after,0.05) p = 0.5566 h = 0
See Also
ranksum, signtest, ttest, ztest
References
[1] Gibbons, J.D., Nonparametric Statistical Inference, 2nd Ed., M. Dekker, 1985.
[2] Hollander, M. and D. A. Wolfe, Nonparametric Statistical Methods, Wiley, 1973.
| schart | signtest | ![]() |
Learn more about the latest releases of MathWorks products: |
| © 1994-2010 The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |