For small treatment and control groups, you may have
difficulty with the Wilcoxon rank sum test of account
of the many ties in Likert data.
Consider the following fictitious data with 50 in each group.
the '
vectors in sample
show different population
proportions at the various Likert scores.
set.seed(2022)
x1 = sample(1:5, 50, rep=T, p=c(2,3,3,1,1))
x2 = sample(1:5, 50, rep=T, p=c(1,1,3,3,2))
summary(x1)
Min. 1st Qu. Median Mean 3rd Qu. Max.
1.00 2.00 2.50 2.64 3.00 5.00
summary(x2)
Min. 1st Qu. Median Mean 3rd Qu. Max.
1.0 3.0 3.0 3.5 4.0 5.0
The resulting sample medians differ, and boxplots show
an effect other than a simple shift upward. The samples
show populations of different shapes. (The plot for x1
is on the bottom.)
boxplot(x1,x2, horizontal=T, col=c("skyblue2","wheat"))
The Wilcoxon SR test finds a difference between the two
samples, but it is probably better to say that the scores in
the treatment group 'dominate' those in the contral group
rather than that the treatment has shifted the median upward.
The implementation of this test in R uses approximate
distributions for the ranks, and so reports no difficulties
on account of ties.
wilcox.test(x1,x2)
Wilcoxon rank sum test
with continuity correction
data: x1 and x2
W = 743.5, p-value = 0.0003168
alternative hypothesis:
true location shift is not equal to 0
Plots of the empirical CDFs (ECDFs) of the two samples, shows
that treatment scores (brown) dominate control scores.
That is, the treatment scores tend to be higher and their
ECDF plots to the right of the control group scores (thus below).
hdr = "Treatment scores (brown) dominate"
plot(ecdf(x1), col="blue", ylab="ECDF", main=hdr)
lines(ecdf(x2), col="brown", lty="dotted")
Notes: If your sample sizes are smaller, your implementation of the Wilcoxon RS test cannot handle ties, and you are
willing to pretend that Likert scores are numeric, then
you might try a Welch two-sample t test (which also shows
significance for my fictitious data).
t.test(x1, x2)
Welch Two Sample t-test
data: x1 and x2
t = -3.6499, df = 91.908, p-value = 0.0004354
alternative hypothesis:
true difference in means is not equal to 0
95 percent confidence interval:
-1.3279746 -0.3920254
sample estimates:
mean of x mean of y
2.64 3.50
The implementation of the Wilcoxon SR test in R
cannot compute an exact P-value for similar data
with sample sizes $n_1=n_2 = 20.$
set.seed(2022)
x1 = sample(1:5, 20, rep=T, p=c(2,3,3,1,1))
x2 = sample(1:5, 20, rep=T, p=c(1,1,3,3,2))
wilcox.test(x1,x2)
Wilcoxon rank sum test
with continuity correction
data: x1 and x2
W = 112.5, p-value = 0.0154
alternative hypothesis:
true location shift is not equal to 0
Warning message:
In wilcox.test.default(x1, x2) :
cannot compute exact p-value with ties
t.test(x1, x2)$p.val
[1] 0.02136043