Which test to use: t-test independent or wilcoxon rank-sum?

I have two groups: A and B. Based on QQ plot and Shapiro-Wilks test, both A and B are not normally distributed. I have included the histogram images below for further context.

A has a sample size of 3068, and B has a sample size of 1981.

The variance for A is 278.3801 while B's is 281.8245.

The variables being compared are independent.

I am conflicted whether or not to use t independent test or Wilcoxson's Rank Sum test. The argument for using the t independent test is because the sample size is large enough to apply the Central Limit Theorem.

On the other hand, I am leaning towards Wilcoxson's Rank Sum test because the sample size of the two groups are drastically different (3068 vs 1981), and the distribution for both groups are non-normal.

Which test do you think you would use? It would also be great to give your explanation as to why you choose the test. Thank you.

Shapiro-Wilk normality test

For A: W = 0.97652, p-value < 2.2e-16

For B: W = 0.97989, p-value = 4.384e-16

Histogram

For A:

For B:

EDIT

Ho: There is no difference in between A and B.

Ha: There is a difference between A and B.

summary(A)

Min. 1st Qu. Median Mean 3rd Qu. Max.

17.00 35.00 50.00 48.84 62.00 90.00

summary(B)

Min. 1st Qu. Median Mean 3rd Qu. Max.

18.00 38.00 53.00 51.33 64.00 90.00

Levene's Test

group coerced to factor.Levene's Test for Homogeneity of Variance (center = median)

    Df F value Pr(>F)


group 1 0.2123 0.645 5047

When selecting a test you first decide what you are trying to measure. You don't include this so I'll assume you are trying to measure whether there is a difference between unpaired groups (the purpose of a t-test or rank sum test). More help selecting methods is available elsewhere.

Next you check the assumptions of the tests you want to use. T-tests are parametric tests that assume the data is normal. Since you state that the data is not normal you cannot use the t-test.

EDIT

whuber correctly points out that I wrongly assumed that the distribution of sample means would be normal. The above should not be taken at face value, and his comment below should be read. Please feel free to post another answer as a correction to this one.

• This is incorrect, because t-tests only require that the sampling distributions of the means be sufficiently close to normal. That will certainly be the case here due to the sample sizes and the constrained, near-uniform distributions of the data. Assuming the purpose is to compare means, the t-test can be recommended because of its power.
– whuber
Commented Nov 16, 2017 at 22:49
• Yes, I am trying to measure if there is a difference between the unpaired group, specifically if median of B > median of A since the distribution doesn't look normal. @whuber Is it possible to get further clarification because I am conflicted for the same reason you stated? Commented Nov 17, 2017 at 2:33
• User185046, you are doing something fishy by adapting your question to what you see in the data. At the outset either you wanted to compare the means or you wanted to compare the medians. If it was the former, use the t-test; if the latter, use a Wilcoxon test.
– whuber
Commented Nov 17, 2017 at 14:18
• @whuber Do you not decide which test to use if the sample data fit the assumptions? i.e. Use the t-test if it fits the normality assumption and the assumption of homogeneity of variance? Commented Nov 19, 2017 at 15:47
• Not at all. These are tests of two different hypotheses. They have different purposes. You wouldn't change your decision objectives just because the test you were first thinking of using is inapplicable, would you? Consider this analogy. Suppose you go to your physician complaining of a headache. After examining you, the physician says "ordinarily I would prescribe aspirin, but I see you are sensitive to aspirin. How about I give you something for your stomach instead?"
– whuber
Commented Nov 19, 2017 at 16:27