# Multi-sample nonparametric test for matched data

I've been wracking my brain trying to come up with a test to do something similar to a paired wilcoxon rank sum test for more than two samples. I've explored the Friedman and Kruskal-Wallis tests, but neither of those do quite what I want (I think). The particular case in the data set I'm dealing with is the following. I have two (or more) samples with measurements that are matched (i.e., the first measurement from sample A corresponds to the first measurement from sample B). If I only had two samples, I could simply take the difference between each measurement (e.g., A(1) - B(1), A(2) - B(2) etc.) and use a Wilcoxon test to see if the observations are significantly different from 0. Does anyone have any suggestions on the most appropriate way to extend this kind of logic to more than 2 samples? Kruskal-Wallis does not take matching observations into account (as far as I can tell) and the Friedman test wouldn't detect a difference in the example below (which I would want to call different):

+-----------+-----+-----+-----+-----+
|Observation|1    |2    |3    |4    |
+-----------+-----+-----+-----+-----+
|Sample A   |10   |10   |0    |0    |
+-----------+-----+-----+-----+-----+
|Sample B   |0    |0    |10   |10   |
+-----------+-----+-----+-----+-----+


My thought is that given N samples I can take every possible pairwise difference between the samples, sum these differences, and use a wilcoxon test to compare the sum to 0. My naive statistical intuition is that since I'm taking differences and sums of values from the same distribution (the assumption in the wilcoxon test) these operations will result in a distribution that is the same as those of each of the samples (and consequently are valid). If any clarifications would help answer my question please let me know and feel free to point out if I'm completely off-base :). Thanks in advance for any advice.

• It seems to me the Friedman test does do what you want, but the example is too small for any non-intraocular test to determine significance. Friedman is designed to test the relative locations of different treatments, which would correspond to your sample labels, within some other factor, which would correspond to your observation number. What am I not understanding? – jbowman Dec 3 '11 at 21:47
• Friedman test is what comes to mind at once, because it is the repeated measures test for more than 2 related samples. But it is not very powerful: Friedman is not the direct extension of Wilcoxon test, rather, it could be seen more as the extension of sign test (which is less powerful than Wilcoxon). – ttnphns Dec 3 '11 at 22:27
• I agree with jbowman and ttnphns. Friedman test will be my 1st choice for this situation. – Tu.2 Dec 4 '11 at 0:04
• Is there a natural ordering to the "observation"s, i.e. a time series? – Ming-Chih Kao Dec 4 '11 at 1:33