Likert scale

R
Published

May 7, 2026

set.seed(2)
library('tidyverse')
library('ordinal')

n_per_group <- 50
dat <- tibble(
  group = rep(c('A', 'B'), each = n_per_group), 
  rating = c(
    rep(1:5, rmultinom(1, n_per_group, c(0.2, 0.3, 0.3, 0.1, 0.1))),
    rep(1:5, rmultinom(1, n_per_group, c(0.1, 0.1, 0.3, 0.3, 0.2)))
  )
)

# T-test:
t.test(rating ~ group, data = dat)

    Welch Two Sample t-test

data:  rating by group
t = -1.8735, df = 95.277, p-value = 0.06406
alternative hypothesis: true difference in means between group A and group B is not equal to 0
95 percent confidence interval:
 -1.02980226  0.02980226
sample estimates:
mean in group A mean in group B 
            2.7             3.2 
# Mann-Whitney-U-test:
wilcox.test(rating ~ group, data = dat)

    Wilcoxon rank sum test with continuity correction

data:  rating by group
W = 992, p-value = 0.0692
alternative hypothesis: true location shift is not equal to 0
# Ordinal (Proportional odds) regression:
fm <- clm(factor(rating) ~ group, data = dat)
summary(fm)
formula: factor(rating) ~ group
data:    dat

 link  threshold nobs logLik  AIC    niter max.grad cond.H 
 logit flexible  100  -156.88 323.77 4(0)  1.09e-08 2.5e+01

Coefficients:
       Estimate Std. Error z value Pr(>|z|)  
groupB   0.6710     0.3636   1.845    0.065 .
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Threshold coefficients:
    Estimate Std. Error z value
1|2 -1.38566    0.30796  -4.500
2|3 -0.03328    0.25658  -0.130
3|4  1.00185    0.28384   3.530
4|5  1.82059    0.33024   5.513