2
$\begingroup$

QQ Plots for Variable xWe have two independent samples, with skewed distribution from two different populations x, and y. When we compute the summary for these numeric vectors, we get following output,

summary(x)
 Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
1.000   1.000   1.000   2.219   3.000 116.000 
length(x)=25312
summary(y)
 Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
1.000   1.000   1.000   1.129   1.000  19.000 
length(y)=49832

As seen, they have equal sample medians with this data. But the intuition is that median for population1(from which sample x is taken) should be greater than median for population2(from which sample y is taken). Though sample medians are same, will it be worthwhile running Wilcoxon Ranksum test for this example? And, can I also get help with the syntax for one-sided Wilcoxon(in R). To be more precise, when we write

wilcox.test(x,y,alternative="greater",paired = FALSE)

Does this mean that median of x is greater than median of y or the other way around? Help is appreciated.

QQ Plots for the variable y

$\endgroup$
  • 1
    $\begingroup$ It is great that you posted summary statistics. Unfortunately, R neglects to report the sizes of the datasets: could you tell us what they are? $\endgroup$ – whuber Dec 30 '19 at 20:10
  • 1
    $\begingroup$ Please see my edits.Size is added for two samples.thanks $\endgroup$ – jayant Dec 30 '19 at 20:14
  • 2
    $\begingroup$ Those sample sizes are so large you do not need a formal test. You ought to progress immediately to a more advanced stage of analysis where you characterize the differences between the distributions. Start with a QQ plot of the two datasets. $\endgroup$ – whuber Dec 30 '19 at 20:17
  • 3
    $\begingroup$ The Wilcoxon test doesn't add any information that that isn't already obvious from the summary statistics (and will be made abundantly clear with a QQ plot). Although you could apply it (using a suitable adjustment for the huge numbers of ties), why bother? $\endgroup$ – whuber Dec 30 '19 at 20:27
  • 1
    $\begingroup$ A qqplot comparing the 2 distributions directly might be more informative than two separate qqnorm plots. See the last "Usage" example on the R qqnorm help page. $\endgroup$ – EdM Dec 30 '19 at 21:44
4
$\begingroup$

As @whuber noted in comments, there is little advantage to using this test for your data set. Your question does, however, bring up some common potential misconceptions about this test.

In general, the Wilcoxon rank-sum test (also known as the Mann-Whitney U test) tests a null hypothesis that the probability is 50% that a randomly drawn value from one population will be larger than a randomly drawn value from the other. (Let's put aside for now the fact that the test was developed for continuous distributions while your data are evidently all integer, with the values identically equal to 1 in half or more of cases, requiring substantial correction for ties.)

The alternative hypothesis can be stated as:

The probability of an observation from population X exceeding an observation from population Y is different (larger, or smaller) than the probability of an observation from Y exceeding an observation from X

To interpret the test in terms of a shift of something like the median, you need to assume that the distribution of values is the same for the 2 samples except for the shift. That can be a pretty strong assumption.

In terms of using the median as a measure of a shift, you already know that the median values of both your samples are the same and at the minimum observed values; that is, both samples are at their (identical) minimum values for over half of the observations. So your intuition about the medians isn't correct in this case; it may be true for some higher percentile than the median (like the third quartile).

Finally, you should be careful about using one-sided tests if there might in principle be differences going in either direction between the 2 samples. In some circumstances like equivalence testing one-sided tests can be appropriate, but you certainly shouldn't, for example, use a one-sided test after you saw that one sample had larger values than the other.

$\endgroup$
  • 1
    $\begingroup$ There is a controversy around the statement that Wann-Whitney's Null hypothesis is the 2 populations [distributions] are equal. This null is more apt for Kolmogorov-Smirnov. Two perfectly identical shape - say, normal - populations with the same centre but different variances won't be distinguished by MW. MW is all about stochastic dominance vs stochastic balance. Or, in other words, it is about the (in)equality of the "location of gravity". $\endgroup$ – ttnphns Dec 30 '19 at 22:12

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