signtest - Sign test

Syntax

p = signtest(x)
p = signtest(x,m)
p = signtest(x,y)
[p,h] = signtest(...)
[p,h] = signtest(...,'alpha',alpha)
[p,h] = signtest(...,'method',method)
[p,h,stats] = signtest(...)

Description

p = signtest(x) performs a two-sided sign test of the null hypothesis that data in the vector x come from a continuous distribution with zero median, against the alternative that the distribution does not have zero median. The p-value of the test is returned in p

p = signtest(x,m) performs a two-sided sign test of the null hypothesis that data in the vector x come from a continuous distribution with median m, against the alternative that the distribution does not have median m. m must be a scalar.

p = signtest(x,y) performs a paired, two-sided sign test of the null hypothesis that data in the vector x-y come from a continuous distribution with zero median, against the alternative that the distribution does not have zero median. x and y must be the same length. Note that a hypothesis of zero median for x-y is not equivalent to a hypothesis of equal median for x and y.

[p,h] = signtest(...) returns the result of the test in h. h = 1 indicates a rejection of the null hypothesis at the 5% significance level. h = 0 indicates a failure to reject the null hypothesis at the 5% significance level.

[p,h] = signtest(...,'alpha',alpha) performs the test at the (100*alpha)% significance level. The default, when unspecified, is alpha = 0.05.

[p,h] = signtest(...,'method',method) computes the p-value using either an exact algorithm, when method is 'exact', or a normal approximation, when method is 'approximate'. The default, when unspecified, is the exact method for small samples and the approximate method for large samples.

[p,h,stats] = signtest(...) returns the structure stats with the following fields:

Example

Test the hypothesis of zero median for the difference between two paired samples.

before = lognrnd(2,.25,10,1);
after = before + (lognrnd(0,.5,10,1) - 1);
[p,h] = signtest(before,after)
p =
   0.3438
h =
   0

The sampling distribution of the difference between before and after is symmetric with zero median. At the default 5% significance level, the test fails to reject to the null hypothesis of zero median in the difference.

References

[1] Gibbons, J. D. Nonparametric Statistical Inference. New York: Marcel Dekker, 1985.

[2] Hollander, M., and D. A. Wolfe. Nonparametric Statistical Methods. Hoboken, NJ: John Wiley & Sons, Inc., 1999.

See Also

ranksum, signrank, ttest, ztest

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS