Compare Two Related Samples

The command compares two related samples using paired Wilcoxon test and sign test.

Wilcoxon Matched Pairs Test (also known as Wilcoxon signed-rank test) allows to compare two matched samples.  Two samples are matched if each observation in one sample is matched with an observation in another sample. For example, repeated measurements for a single sample (the same participants are present) – patients' health status (on a rank scale) before and after a treatment or customer awareness before and after an advertising campaign. The test does not assume normality and can be used as a nonparametric alternative to the paired t-test for dependent samples.

Sign test allows to detect consistent differences between the pairs and has a similar purpose as the Wilcoxon test. The sign test has less power and it is less sensitive than the Wilcoxon test, but it has a wider range of applications due to less strict assumptions (no assumption about the shape of distribution).

How To

Run: Statistics→Nonparametric Statistics → Compare Two Related Samples...

Select two variables to compare.

Results

The report includes Wilcoxon and sign tests results.

Wilcoxon Matched Pairs Test requires samples measured on at least an ordinal scale and assumes that the paired values are randomly and independently drawn, and each paired difference comes from a symmetric continuous distribution. The null hypothesis states that the difference in medians is zero, but this is only true if the shape of the distribution for each sample is assumed to be the same. The departures from the null hypothesis that the test tries to detect are location shifts: the alternative hypothesis for the two-sided test is that the two population relative frequency distributions are not identical (differ in location).

The test statistic is calculated in the following way. For each case, the difference between the values is calculated. The remaining pairs are ordered from smallest absolute difference to largest absolute difference. Pairs are ranked, starting with the smallest as 1. The test statistic T is defined as proposed by Siegel (1956) – the smaller of the two rank sums corresponding to positive differences  and negative differences . For relatively large samples (N > 25) the statistic T is approximately normally distributed with mean  and variance , where  is the number of non-zero differences (sample size without ties).  When ties are present the variance corrected for ties is computed as

,

where  is the number of tied values in the ith tie group (Iman, 1974; Lehmann, 1975).

Z is the standardized test statistic. Z is defined as , and approximately has a normal distribution N(0,1).

The p-value is for a two-sided test. If the p value is less than the α (0.05), then the null hypothesis is rejected and the alternative hypothesis is accepted (two-sided H1: medians are not equal ).

Sign Test for two paired samples can be also used to check the null hypothesis if the difference between the samples has zero median, but it does not carry an assumption about the symmetric distribution of differences and does not take the magnitude of the observations into account, whereas the Wilcoxon signed rank test does.

The mechanics of the sign test is simple: differences between the pairs of sample values ​​are calculated, zero differences are excluded, then the number of positive differences  (N +) and negative differences  are determined. Z statistic is defined as , where N (N-Ties) is the sample size without ties. For relatively large samples (N > 25), Z statistic has approximately normal distribution , and if the two-sided p-value (Z) is less than  level (0.05), then the null hypothesis is rejected in favor of the alternative hypothesis H1: .

When the sample size without ties is less than or equal to 25 (), the  statistic is approximately binomially distributed . If the two-sided p-value (B) is less than  (0.05), the null hypothesis is rejected and the alternative hypothesis H1 is accepted: . The smaller of the values ​​ and  (min [N-,N+]) is used for the two-sided test.

 

References

Altman D.G. (1991) Practical statistics for medical research. London: Chapman and Hall.

Iman, R. L. (1974), “Use of a -Statistic as an Approximation to the Exact Distribution of the Wilcoxon Signed Rank Statistic,” Communications in Statistics, 3, 795–806.

Lehmann, E. L. 1975. Nonparametrics: Statistical Methods Based on Ranks. San Francisco: Holden-Day.

Siegel, Sidney (1956). Non-parametric statistics for the behavioral sciences. New York: McGraw-Hill. pp. 75–83.