# How can I control for a variable while conducting Wilcoxon Rank Sum Test?

I did a Wilcoxon rank sum test to figure out if there is any difference in the distribution of Variable $X_1$ for two groups. The test results showed that the difference does exist.

I, however, suspect that there is a confounding variable $X_2$, which is causing this difference.

How can I control for $X_2$?

Example Scenario:
Joe wants to understand if there is any difference in the listening capabilities of Males and Females. Joe thinks that "Age" could be a confounding variable in his study; so he wants to control for "Age". Is there any non parametric test that Joe can conduct?

The generalization of the Wilcoxon-Mann-Whitney 2-sample test and the Kruskal-Wallis $k$-sample test is the proportional odds model. The PO model allows all the modeling flexibility that regression models support, including covariate adjustment. Details may be found in my course notes at http://biostat.mc.vanderbilt.edu/rms .