Computes a distribution-free confidence interval for a difference of population medians in a paired-samples design. This function also computes the standard error of each median and the covariance between the two estimated medians.

ci.median.ps(alpha, y1, y2)

Arguments

alpha

alpha level for 1-alpha confidence

y1

vector of scores for measurement 1

y2

vector of scores for measurement 2 (paired with y1)

Value

Returns a 1-row matrix. The columns are:

  • Median1 - estimated median for measurement 1

  • Median2 - estimated median for measurement 2

  • Median1-Median2 - estimated difference of medians

  • SE1 - standard error of median 1

  • SE2 - standard error of median 2

  • COV - covariance of the two estimated medians

  • LL - lower limit of the confidence interval

  • UL - upper limit of the confidence interval

References

Bonett DG, Price RM (2020). “Interval estimation for linear functions of medians in within-subjects and mixed designs.” British Journal of Mathematical and Statistical Psychology, 73(2), 333--346. ISSN 0007-1102, doi:10.1111/bmsp.12171 .

Examples

y1 <- c(21, 4, 9, 12, 35, 18, 10, 22, 24, 1, 6, 8, 13, 16, 19)
y2 <- c(67, 28, 30, 28, 52, 40, 25, 37, 44, 10, 14, 20, 28, 40, 51)
ci.median.ps(.05, y1, y2)
#>  Median1 Median2 Median1-Median2       SE        LL        UL      SE1      SE2
#>       13      30             -17 3.362289 -23.58996 -10.41004 3.085608 4.509735
#>       COV
#>  9.276849

# Should return:
# Median1 Median2 Median1-Median2       SE        LL        UL  
#      13      30             -17 3.362289 -23.58996 -10.41004 
#      SE1      SE2      COV
# 3.085608 4.509735 9.276849