signtest
statistics: pval = signtest (x)
statistics: pval = signtest (x, my)
statistics: pval = signtest (x, my, Name, Value)
statistics: [pval, h] = signtest (…)
statistics: [pval, h, stats] = signtest (…)
Signed test for median.
pval = signtest (x) returns the p-value of a
two-sided sign test. It tests the null hypothesis that data in x come
from a distribution with zero median at the 5% significance level. x
must be a vector.
If the second argument my is a scalar, the null hypothesis is that
x has median my, whereas if my is a vector, the null
hypothesis is that the distribution of x - my has zero
median.
pval = signtest (…, Name, Value) performs the
Wilcoxon signed rank test with additional options specified by one or more of
the following Name, Value pair arguments:
| Name | Value |
|---|---|
'alpha' | A scalar value for the significance level of the test. Default is 0.05. |
'tail' | A character vector specifying the alternative hypothesis. It can take one of the following values: |
Source Code: signtest
| Value | Description |
|---|---|
'both' | For one-sample test (my is empty or a
scalar), the data in x come from a continuous distribution with median
different than zero or my. For two-sample test (my is a vector),
the data in x - my come from a continuous distribution
with median different than zero. |
'left' | For one-sample test (my is empty or a
scalar), the data in x come from a continuous distribution with median
less than zero or my. For two-sample test (my is a vector), the
data in x - my come from a continuous distribution with
median less than zero. |
'right' | For one-sample test (my is empty or a
scalar), the data in x come from a continuous distribution with median
greater than zero or my. For two-sample test (my is a vector),
the data in x - my come from a continuous distribution
with median greater than zero. |
Source Code: signtest
| Name | Value |
|---|---|
'method' | A character vector specifying the method for computing the p-value. It can take one of the following values: |
Source Code: signtest
| Value | Description |
|---|---|
'exact' | Exact computation of the p-value. It
is the default value for fewer than 100 observations when 'method' is
not specified. |
'approximate' | Using normal approximation for
computing the p-value. It is the default value for 100 or more
observations when 'method' is not specified. |
Source Code: signtest
[pval, h] = signtest (…) also returns a logical
value indicating the test decision. If h is 0, the null hypothesis is
accepted, whereas if h is 1, the null hypothesis is rejected.
[pval, h, stats] = signtest (…) also returns
the structure stats containing the following fields:
| Field | Value |
|---|---|
sign | Value of the sign test statistic. |
zval | Value of the z-statistic (only computed
when the 'method' is 'approximate'). |
Source Code: signtest
See also: signrank, tiedrank, runstest
Source Code: signtest