# Understanding the Wilcoxon rank-sum one-sided test

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.

set.seed(123)
Nj  <- c(20, 30)
DVa <- rnorm(Nj, mean= 95, sd=15)
DVb <- rnorm(Nj, 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

levels(wIndDf$IV)  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 • What are$\mu_1$and$\mu_2\$ in your question? Mar 11, 2016 at 10:38
• @user08041991 is your question just how to order the one sided hypothesis for a two sample test? Apr 6, 2017 at 18:28