Sample Comparison – Analysis of Pairs of Samples with Unequal Sizes

group-differenceswilcoxon-mann-whitney-test

I have four samples $x_1, x_2$ and $y_1, y_2$ with $n_{x1} \neq n_{x2} \neq n_{y1} \neq n_{y2} $. I calculated, using a Wilcoxon rank sum test, that $x_1$ is significantly different to $x_2$ and $y_1$ significantly different to $y_2$.

However, I would like to test whether the difference $x_1 – x_2$ differs significantly to $y_1 – y_2$ but I have no idea how do to that given the unequal sample sizes.

Any ideas or suggestions would be really appreciated.

Best Answer

If you consider all four groups in a Kruskal-Wallis (the rank based 'one-way anova'), you would be in the position of wanting to test a contrast there.

Now Kruskal-Wallis is basically a special case of the proportional odds ordinal logistic model.

You could get this contrast by testing a combination of coefficients in the proportional odds ordinal logistic model.

That is, the kinds of contrasts you'd tend to do in ANOVA pretty much can be done for a generalization of the Wilcoxon type of approach.

I think Frank Harrell's R package rms may be able to do this, for example.

That said, I agree with @NickCox's suggestion of considering modelling with glm's more generally; there may be GLMs that describe the mean, the mean-variance relationship and the general shape of your data fairly well, and in that case, your contrasts become not only easy to test, but perhaps also more directly interpretable in terms of relationships between means, especially if identity links were used.