ci.median2 {statpsych} | R Documentation |
Computes a confidence interval for a difference of population medians in a 2-group design.
ci.median2(alpha, y1, y2)
alpha |
alpha level for 1-alpha confidence |
y1 |
vector of scores for group 1 |
y2 |
vector of scores for group 2 |
Returns a 1-row matrix. The columns are:
Median1 - estimated median from group 1
Median2 - estimated median from group 2
Median1-Median2 - estimated difference in medians
SE - standard error of the difference
LL - lower limit of the confidence interval
UL - upper limit of the confidence interval
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.
y1 <- c(32, 39, 26, 35, 43, 27, 40, 37, 34, 29) y2 <- c(36, 44, 47, 42, 49, 39, 46, 31, 33, 48) ci.median2(.05, y1, y2) # Should return: # Median1 Median2 Median1-Median2 SE LL UL # [1,] 34.5 43 -8.5 4.316291 -16.95977 -0.04022524