Categories &

Functions List

Function Reference: signrank

statistics: pval = signrank (x)

statistics: pval = signrank (x, my)

statistics: pval = signrank (x, my, Name, Value)

statistics: [pval, h] = signrank (…)

statistics: [pval, h, stats] = signrank (…)

Wilcoxon signed rank test for median.

pval = signrank (x) returns the p-value of a two-sided Wilcoxon signed rank test. It tests the null hypothesis that data in x come from a distribution with zero median at the 5% significance level under the assumption that the distribution is symmetric about its median. 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 = signrank (…, Name, Value) performs the Wilcoxon signed rank test with additional options specified by one or more of the following Name, Value pair arguments:

NameValue
'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:
ValueDescription
'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.
NameValue
'method'A character vector specifying the method for computing the p-value. It can take one of the following values:
ValueDescription
'exact'Exact computation of the p-value. It is the default value for 15 of fewer observations when 'method' is not specified.
'approximate'Using normal approximation for computing the p-value. It is the default value for more than 15 observations when 'method' is not specified.

[pval, h] = signrank (…) 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] = signrank (…) also returns the structure stats containing the following fields:

FieldValue
signedrankValue of the sign rank test statistic.
zvalValue of the z-statistic, computed only when the 'method' is 'approximate' and empty otherwise. The field is always there.
RankBiserialThe matched-pairs rank-biserial correlation, the effect size of the test: the sum of the signed ranks of the positive differences less that of the negative ones, divided by the sum of all the ranks, over the nonzero differences. It lies in [-1, 1].
RankBiserialCIIts two-sided confidence interval at the level 100 (1 - alpha) percent, whatever the 'tail'.

The last two fields are an Octave extension. By default the interval is the normal interval of the Fisher transformed correlation, with standard error sqrt(n (n + 1) (2n + 1) / 6) / (n (n + 1) / 2) over the n nonzero differences. The R package effectsize computes the same interval but counts n over the elements of x that differ from the hypothesised median, so where some differences are zero its interval is narrower than this one. Two further options choose otherwise:

NameValue
'ConfidenceIntervalType''exact', the default, or 'bootstrap' for the bias-corrected and accelerated bootstrap interval, resampling the pairs.
'NumBootstraps'The number of bootstrap replicates, a positive integer, 1000 by default.

See also: tiedrank, signtest, runstest, ranksum, meanEffectSize

Source Code: signrank