17.5.3.2 Algorithm (sign2)

The paired sample sign test tests the median difference between pairs of scores from two matched samples.

For two match samples \(\{x_i,y_i\}\,\!\), \(i=1,2,\ldots ,n\). The null hypothesis \(H_0\,\!\) iis that the medians of the paired samples are the same, while the alternative hypothesis \(H_1\,\!\)can be one- or two-tailed (see below). We compute:

  1. The test statistics \(S\,\!\) , which is the number of pairs for which \(x_i<y_i\,\!\);
  2. The number \(n_i\,\!\) of non-tied pairs \(x_i=y_i\,\!\);
  3. The lower tail probability \(p\,\!\) corresponding to \(S\,\!\) (adjusted to allow the complement \(1-p\,\!\) to be used in an upper tailed or a two-tailed test). \(p\,\!\) is the probability of observing a value \(\leq S\,\!\) if \(S\leq \frac 12n_1\); or of observing a value \(<S\,\!\) if \(S> \frac 12n_1\), given that \(H_0 \,\! \) is true. If \(S=\frac 12n_1\), then \( p=0.5 \,\! \).

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

  1. \(H_1\,\!\): median of \( x\neq \) median of \(y\,\!\). \(H_0\,\!\) is rejected if \( 2\times \min (p,1-p)<\alpha\) .
  2. \(H_1\,\!\): median of \( x< \,\! \)median of \(y\,\!\). \(H_0\,\!\) is rejected if \( 1-p<\alpha \,\!\)
  3. \(H_1\,\!\): median of \( x> \,\! \)median of \(y\,\!\). \(H_0\,\!\) is rejected if \( p<\alpha\,\!\)

For more details of the algorithm, please refer to: nag_sign_test (g08aac).