signtest
Test for median.
Perform a signtest of the null hypothesis that x is from a distribution that has a zero median. x must be a vector.
If the second argument m is a scalar, the null hypothesis is that X has median m.
If the second argument y is a vector, the null hypothesis is that
the distribution of x - y
has zero median.
The argument "alpha"
can be used to specify the significance level
of the test (the default value is 0.05). The string
argument "tail"
, can be used to select the desired alternative
hypotheses. If "tail"
is "both"
(default) the null is
tested against the two-sided alternative median (x) != m
.
If "tail"
is "right"
the one-sided
alternative median (x) > m
is considered.
Similarly for "left"
, the one-sided alternative median
(x) < m
is considered.
When "method"
is "exact"
the p-value is computed using an
exact method. When "method"
is "approximate"
a normal
approximation is used for the test statistic. When "method"
is not
defined as an optional input argument, then for length (x) < 100
the "exact"
method is computed, otherwise the "approximate"
method is used.
The p-value of the test is returned in pval. If h is 0 the null hypothesis is accepted, if it is 1 the null hypothesis is rejected. stats is a structure containing the value of the test statistic (sign) and the value of the z statistic (zval) (only computed when the ’method’ is ’approximate’.
Source Code: signtest