# Mann-Whitney-U test or unpaired-T test if only one group non-normal

If I have two patient groups (disease+ vs disease-) and I want to compare both groups in terms of their BMI. There are n = 30 in the disease+ group while only n = 18 in the non-disease group. As far as I understand, the first step is to check the normality of the BMI data in each group and I used the following code:

with(mydata, shapiro.test(BMI[disease_status == "none"]))
with(mydata, shapiro.test(BMI[disease_status == "disease"]))


I want to ask if the disease group yields the p-value >0.05 after the Shapiro test while the non-disease group yields the p-value < 0.05, does it mean I should use the Mann-Whitney U test?

(I know if both p are < 0.05, then I must use the MW-U test but I am not sure what to do if only one p is < 0.05).

• If the goal is to know whether BMI means differ between the two groups ('disease' and not), then use 2-sample t for nearly-normal data. If samples are not from normal population but of similar shapes, use 2-sample Mann-Whitney-Wilcoxon rank sum test to see if medians differ. (M-W and Wilcoxon RS are equivalent but use different test statistics. Some stat software uses M-W, some Wilcoxon SR.) Apr 3, 2022 at 19:30
• The Wilcoxon-Mann-Whitnney isn't a test of difference in medians either. Apr 4, 2022 at 2:38
• Indeed we've had several very confused people posting to ask why their Mann-Whitney rejects when the sample medians are identical; this is a confusion caused by this mistaken notion that it tests medians. On occasion you can even see it pick up an effect running in the opposite direction to the direction of difference in medians. Apr 4, 2022 at 6:04

Session using R:

(1) Nearly normal data: x1 no disease, x2 disease

summary(x1)
Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
16.07   18.66   19.85   19.91   20.98   23.57
summary(x2)
Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
19.90   22.39   23.09   23.36   24.52   27.34


Shapiro-Wilk tests may not be accurate for small samples. Also, these data are rounded to two places and, strictly speaking, rounded normal data are not exactly normal. Nevertheless, both samples are consistent with samples from normal populations, according to Shapio-Wilk tests:

shapiro.test(x1)$$p.val [1] 0.7933927 shapiro.test(x2)$$p.val
[1] 0.9602677


Many statisticians would prefer looking at normal Q-Q plots to check for approximate normality. Plots should be nearly linear (except possibly with some minor 'wobbles' near the lower and upper tails). The plots below are consistent with normal data.

par(mfrow=c(1,2))
qqnorm(x1, main="Q-Q of 1st Sample")
qqline(x1, col="blue")
qqnorm(x2, main="Q-Q Plot of 2nd Sample")
qqline(x2, col="blue")
par(mfrow=c(1,1))


A Welch 2-sample t test finds a significant difference between the two sample means. (A Welch test does not require equal variances and so is preferable to a pooled test unless we have advance knowledge that populations have equal variances)

t.test(x1, x2)

Welch Two Sample t-test

data:  x1 and x2
t = -7.3334, df = 56.567, p-value = 9.217e-10
alternative hypothesis:
true difference in means is not equal to 0
95 percent confidence interval:
-4.393060 -2.508273
sample estimates:
mean of x mean of y
19.90600  23.35667


(2) Right-skewed, non-normal data: y1 no disease, y2 disease

summary(y1)
Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
5.29   13.16   16.77   19.61   24.30   43.87
sd(y1)
[1] 9.359215

summary(y2)
Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
7.70   15.76   23.84   24.45   31.57   61.93
sd(y2)
[1] 11.37608


Boxplots (y1 bottom), show that both samples are moderately right-skewed with some boxplot outliers at the right. The 'notches' in the sides of the boxes overlap, suggesting that we will not find a significant difference in locations.

boxplot(y1,y2, col="skyblue2", horizontal=T,notch=T)


Neither sample passes the Shapiro-Wilk normality test; both give P-values below 5%.

shapiro.test(y1)$$p.val [1] 0.04737606 shapiro.test(y2)$$p.val
[1] 0.02658591


A 2-sample nonparametric Wilcoxon rank sum test does not find a significant difference in locations at the 5% level:

wilcox.test(y1, y2)

Wilcoxon rank sum test

data:  y1 and y2
W = 329, p-value = 0.0747
alternative hypothesis:
true location shift is not equal to 0