Say we have the following data:
set.seed(123) data <- data.frame(x = c(rnorm(50, 1, 1), rnorm(50, 5, 2)), y = c(rep('A', 50), rep('B', 50)))
Which yields the following boxplot (
boxplot(data$x ~ data$y)):
Now let's say I want to test if the two samples have the same location parameters (median and/or mean). In my real case, the data are clearly not normal, so I've decided to run the Wilcoxon-Mann-Whitney test, like this:
wilcox.test(data$x ~ data$y)
However, I would like the alternative hypothesis to be that B,
data$y's "second" factor, comes from a distribution with higher position parameters. I've tried setting the
alternative parameter to "greater" and "less", but apparently the alternative hypotheses are not what I'm looking for. For example,
alternative = "greater" tells me "alternative hypothesis: true location shift is greater than 0";
alternative = "less" tells me "alternative hypothesis: true location shift is less than 0".
How can I tweak the
wilcox.test() function in order to have the alternative hypothesis I want (B comes from a distribution with higher position parameters than A)? Or should I just use another test instead?