I am doing a Wilcoxon rank sum test (aka Wilcoxon-Mann-Whitney) with R. There are two variables "ScorePerView", that is metric and "HasCodeElement", that is binary.

So the syntax is like that

wilcox.test(ScorePerView ~ HasCodeElement, data=Datenmatrix, paired=FALSE, alternative='less')

When the result is significant (p-value < 0.005), then one distribution is lower or equal to the other.

But which one is lower? Is the one where HasCodeElement is 0 is lower (or equal) then the one where HasCodeElement is 1. Or is it the other way where HasCodeElement is 1 is lower (or equal) then the one where HasCodeElement is 0.

How can I interpret the R output on an one tailed test?

Here is my result with the syntax above.

enter image description here

Found the answer here: How do I interpret the Mann-Whitney U when using R's formula interface

Also marked the Question as duplicated.

  • $\begingroup$ Thanks for going to the effort involved in finding the answer yourself and marking the question as a duplicate; this helps to make our site work better. $\endgroup$
    – Glen_b
    Aug 30, 2015 at 2:09

1 Answer 1


I don't think you should use the formula interface with ~. If you look at the syntax of the function wilcox.test here you will see that you can also separate your two samples as x and y and use wilcox.test(x,y,...). This will remove any ambiguity. If you use wilcox.test(x,y,paired=FALSE,alternative="less"), and the p-value is significant, then it means that x and y come from different populations, and that y comes from a population with larger values than x.

  • $\begingroup$ My problem is totally different. I have a metric and a binary variable. And they are not paired. It is like this: r-tutor.com/elementary-statistics/non-parametric-methods/…. But I also want to know the direction. $\endgroup$
    – Chris
    Aug 29, 2015 at 20:21
  • $\begingroup$ I corrected my answer at the same time your wrote your comment I guess. And I was proposing to split x into x and y based on your binary factor $\endgroup$
    – Antoine
    Aug 30, 2015 at 8:49

Not the answer you're looking for? Browse other questions tagged or ask your own question.