naginterfaces.library.nonpar.test_sign(x, y)[source]

test_sign performs the Sign test on two related samples of size .

For full information please refer to the NAG Library document for g08aa

xfloat, array-like, shape

and must be set to the th pair of data values, , for .

yfloat, array-like, shape

and must be set to the th pair of data values, , for .


The Sign test statistic, .


The number of non-tied pairs, .


The lower tail probability, , corresponding to .

(errno )

On entry, .

Constraint: .

(errno )

On entry, the samples are identical, i.e., .


In the NAG Library the traditional C interface for this routine uses a different algorithmic base. Please contact NAG if you have any questions about compatibility.

The Sign test investigates the median difference between pairs of scores from two matched samples of size , denoted by , for . The hypothesis under test, , often called the null hypothesis, is that the medians are the same, and this is to be tested against a one - or two-sided alternative (see below).

test_sign computes:

  1. the test statistic , which is the number of pairs for which ;

  2. the number of non-tied pairs ;

  3. the lower tail probability corresponding to (adjusted to allow the complement to be used in an upper one tailed or a two tailed test). is the probability of observing a value if , or of observing a value if , given that is true. If , is set to .

Suppose that a significance test of a chosen size is to be performed (i.e., is the probability of rejecting when is true; typically is a small quantity such as or ). The returned value of can be used to perform a significance test on the median difference, against various alternative hypotheses , as follows

  1. : median of median of . is rejected if .

  2. : median of median of . is rejected if .

  3. : median of median of . is rejected if .


Siegel, S, 1956, Non-parametric Statistics for the Behavioral Sciences, McGraw–Hill