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).

  • 1
    $\begingroup$ 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.) $\endgroup$
    – BruceET
    Apr 3, 2022 at 19:30
  • 2
    $\begingroup$ The Wilcoxon-Mann-Whitnney isn't a test of difference in medians either. $\endgroup$
    – Glen_b
    Apr 4, 2022 at 2:38
  • 3
    $\begingroup$ 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. $\endgroup$
    – Glen_b
    Apr 4, 2022 at 6:04

1 Answer 1


Session using R:

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

   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
  16.07   18.66   19.85   19.91   20.98   23.57 
   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:

[1] 0.7933927
[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.

 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")

enter image description here

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

   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
   5.29   13.16   16.77   19.61   24.30   43.87 
 [1] 9.359215

   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
   7.70   15.76   23.84   24.45   31.57   61.93 
[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)

enter image description here

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

[1] 0.04737606
[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

Note: You may find additional useful information in some of the 'Related' links shown in the margin of this page.

  • 1
    $\begingroup$ Thank you for sharing! You showed two examples (both passed vs both failed the Shapiro-Wilk normality). However, my original concern is if one pass but one fails...Do you know what to do next if that is the case? $\endgroup$
    – R Beginner
    Apr 4, 2022 at 0:36
  • 1
    $\begingroup$ If either of the two samples is clearly not normal, I would not use the t test. $\endgroup$
    – BruceET
    Apr 4, 2022 at 0:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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