Computes a distribution-free confidence interval for a difference of population medians in a 2-group design. Tied scores within each group are assumed to be rare.
Value
Returns a 1-row matrix. The columns are:
Median1 - estimated median for group 1
Median2 - estimated median for group 2
Median1-Median2 - estimated difference of medians
SE - standard error
LL - lower limit of the confidence interval
UL - upper limit of the confidence interval
References
Bonett DG, Price RM (2002). “Statistical inference for a linear function of medians: Confidence intervals, hypothesis testing, and sample size requirements.” Psychological Methods, 7(3), 370–383. ISSN 1939-1463, doi:10.1037/1082-989X.7.3.370 .
Examples
y1 <- c(32.1, 39.8, 26.3, 35.0, 43.1, 27.0, 40.9, 37.4, 34.0, 29.2)
y2 <- c(36.8, 44.0, 47.1, 42.7, 49.0, 39.6, 46.2, 31.6, 33.1, 48.4)
ci.median2(.05, y1, y2)
#> Median1 Median2 Median1-Median2 SE LL UL
#> 34.5 43.35 -8.85 4.494993 -17.66002 -0.0399751
# Should return:
# Median1 Median2 Median1-Median2 SE LL UL
# 34.5 43.35 -8.85 4.494993 -17.66002 -0.0399751