: [pval, b, n] = sign_test (x, y, alt)

For two matched-pair samples x and y, perform a sign test of the null hypothesis PROB (x > y) == PROB (x < y) == 1/2.

Under the null, the test statistic b roughly follows a binomial distribution with parameters n = sum (x != y) and p = 1/2.

With the optional argument alt, the alternative of interest can be selected. If alt is "!=" or "<>", the null hypothesis is tested against the two-sided alternative PROB (x < y) != 1/2. If alt is ">", the one-sided alternative PROB (x > y) > 1/2 ("x is stochastically greater than y") is considered. Similarly for "<", the one-sided alternative PROB (x > y) < 1/2 ("x is stochastically less than y") is considered. The default is the two-sided case.

The p-value of the test is returned in pval.

If no output argument is given, the p-value of the test is displayed.

Package: statistics