# 1. Two groups of different sizes, no ties:
set.seed(113)
a <- rnorm(30, mean = 0, sd = 1)
b <- rnorm(40, mean = 0.5, sd = 1)
cliff_delta(a, b)
# 2. With ties (ordinal data):
o1 <- c(1, 2, 2, 3, 3, 3, 4, 4, 5)
o2 <- c(2, 3, 3, 4, 4, 5, 5, 5)
cliff_delta(o1, o2)
# 3. Robust to right skew. Cliff's delta on the raw, untransformed
# drinking outcome from the Smith, Meyers, and Delaney (1998)
# trial, comparing the Community Reinforcement Approach (CRA)
# against standard care. Because the statistic uses only ranks it
# needs no normalizing transformation of the heavily skewed
# outcome, unlike the standardized mean difference.
data(drinks_trial)
cra <- drinks_trial$drinks_per_week[drinks_trial$treatment == "CRA"]
std <- drinks_trial$drinks_per_week[drinks_trial$treatment == "Standard"]
cliff_delta(cra, std)
Run the code above in your browser using DataLab