# Non parametric tests on two paired samples

The sign test and the Wilcoxon test are 2 non-parametric ways to compare the ranks of two paired samples. Run them in Excel using the XLSTAT software.

## Non parametric Tests on two paired samples in XLSTAT

XLSTAT proposes two **non parametric tests **for the cases where samples are **paired**: the sign test and the Wilcoxon signed rank test.

Let S1 be a sample made up of n observations (x1, x2, …, xn) and S2 a second sample paired with S1, also comprising n observations (y1, y2, …, yn). Let (p1, p2, …, pn) be the n pairs of values (xi, yi).

## The Sign test

Let N+ be the number of pairs where yi < xi, N0 the number of pairs where yi = xi, and N- the number of pairs where yi > xi. We can show that N+ follows a binomial distribution with parameters (n-N0) and probability ½. The expectation and the variance of N+ are therefore:

**E(N+) = (n - N0) / 2** and **V(N+) = (n - N0) / 4**

The p-value associated with N+ and the type of test chosen (two-tailed, right or left one-tailed) can therefore be determined exactly.

*Note:*

*This test is called the sign test as it constructs the differences within the n pairs from the sign. This test is therefore used to compare evolutions evaluated on an ordinal scale. For example, this test would be used to determine if the effect of a medicine is positive from a survey where the patient simply declares if he feels less well, not better, or better after taking it.**The disadvantage of the sign test is that it does not take into account the size of the difference between each pair, data which is often available.*

## Wilcoxon signed-rank test

Wilcoxon proposed a test which takes into account the size of the difference within pairs. This test is called the Wilcoxon signed rank test, as the sign of the differences is also involved.

As for the sign test, the differences for all the pairs is calculated, then they are ordered and finally the positive differences S1, S2, …, Sp and the negative differences R1, R2, …, Rm (p+m=n) are separated.

The statistic used to show whether both samples have the same position is defined as the sum of the Si's:

**Vs = ∑(i=1…p) Si**

The expectation and the variance of Vs are:

**E(Vs) = n(n+1) / 4** and **V(Vs) = n(n + 1)(2n + 1) / 24**

### analyze your data with xlstat

Related features