# How to test if 2 means are significantly different for non-normal non-paired data

I have 4 averages from 4 samples and I want to test if the means are significantly different. When I look at the QQ plots and the shapiro wilk test (all have very low p values) the data is not normal so I was thinking of using the WIlcoxon signed rank test but that seems to be for "matched pair samples". My data is not paired. They are 4 independent samples.

What tests can I use to test if the means are significantly different from each other?

Thank you.

• What do your data consist of (are these counts, measurements of some quantity, times, proportions, exchange rates, angles, Likert scores, category labels recorded as integers, ...)? – Glen_b Mar 30 '15 at 0:29

If you are willing to assume that - under the alternative hypothesis - the four population distributions may differ only by a shift in location (e.g. they have the same variance), then the "standard" distribution-free test to compare means would be the famous Kruskal-Wallis test. It generalizes the Wilcoxon rank sum test to more than two groups.

For not too small groups (and if above mentioned equal variance assumption seems plausible), it usually yields the same test decision as the classic F-test, even if the samples do not look very normal.

If the shift in location alternative is not plausible however (and again the groups are not too small), one of the least problematic ways to compare four means would be by using F-test with Welch correction for unequal variances.

• Michael -- To make the assumption of same variance do i just compare the variance and standard deviation of the 4 groups to decide if I can use the Kruskal Wallis test? And if the variances are NOT equal your last paragragh mentions using an F-test with Welch correction. Do you know what formula that is in R? THank you. – joesyc Mar 29 '15 at 20:38
• Michael - wouldn't the Mann-Whitney-Wilcoxon Test work. In R the notes on the function state: if both x and y are given and paired is FALSE, a Wilcoxon rank sum test (equivalent to the Mann-Whitney test: see the Note) is carried out. In this case, the null hypothesis is that the distributions of x and y differ by a location shift of mu and the alternative is that they differ by some other location shift......so wouldn' tthis be what I want:: wilcox.test(A ~ B,mu=0) – joesyc Mar 29 '15 at 20:53
• MIchael - when I run wilcox.test(A, B,mu=0) and kruskal.test(list(A, B)) I get the pretty much the same p-value out to 2 or 3 decimals so these 2 test must be doing the same thing. kruskal.test is the test you referred to and wilcox.test is the man-whitley wicoxon sum rank test where A and B are 2 of the 4 sample. But you are saying this only works I the variance of the samples I compare are the same? – joesyc Mar 29 '15 at 21:09
• The Wilcoxon rank sum test is the two group special case of Kruskal-Wallis. It can, in addition, do one-sided comparisons. – Michael M Mar 30 '15 at 6:08
• Unequal variance F tests are available in R using 'oneway.test'. – Michael M Mar 30 '15 at 6:10

One possibility if you can assume identical distributions when the null is true* would be to use a permutation test with the difference in means as the test statistic.

*(not necessarily restricted to a shift alternative, though it's the one that would be the most readily interpretable)

However, with four groups (and six pairwise comparisons), you might be better starting with some overall test for a difference ($H_0$ all population means equal against an omnibus alternative ... at least one population mean differs from at least one other) and then perform some kind of multiple comparisons procedure.

You could do a permutation test for that case too, but depending on the characteristics of the distribution your data comes from you may be better off with a Kruskal Wallis test (essentially a permutation-test for ANOVA-on-the-ranks).