With a simple two sided test, the null hypothesis is often set as:

Hn: µ1- µ2 = 0

and if we get a p-value less than 0.05, we can reject the null hypothesis and accept the alternative. That is:

Ha: µ1 - µ2 != 0

But if we expect a difference, we can create a one-side test. Taking the example from here, we run a one-sided Wilcoxon rank-sum test test on the data.

Nj  <- c(20, 30)
DVa <- rnorm(Nj[1], mean= 95, sd=15)
DVb <- rnorm(Nj[2], mean=100, sd=15)
wIndDf <- data.frame(DV=c(DVa, DVb),
                     IV=factor(rep(1:2, Nj), labels=LETTERS[1:2]))

Not included on the original website, we can visualise the data

boxplot(DV ~ IV, data = wIndDf)

We also assess the levels of the data


And we see that A will be compared to B. To run a one-side test, the code is as (direct from the website)

wilcox.test(DV ~ IV, alternative="less", conf.int=TRUE, data=wIndDf)

And we get a p-value < 0.05, so we can reject the null. But what was the null, and the alternative

From the alternative command, am I correct in saying the null is:

µA < µB

  • $\begingroup$ What are $\mu_1$ and $\mu_2$ in your question? $\endgroup$
    – Glen_b
    Commented Mar 11, 2016 at 10:38
  • $\begingroup$ @user08041991 is your question just how to order the one sided hypothesis for a two sample test? $\endgroup$
    – AdamO
    Commented Apr 6, 2017 at 18:28

1 Answer 1


The IV variable is a factor with two ordered levels, A and B. The A is the referent level and the B is the comparitor. The difference in location is of a A - B form. It's easy to check this by giving B a much larger mean and testing the "greater" and "less" commands. The presentation of the estimate and its CI is also the same as a T-test. A more interesting question is what exactly is lesser or greater with the Wilcoxon. The Wilcoxon has been questioned extensively as far as interpretation and credibility of results. It is not a median nor is it a mean unless strong distributional assumptions are met.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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