To obtain the Hodges-Lehmann statistic in R, you can use the wilcox.test function with the option "conf.int=TRUE" (which stands for "confidence interval"). The Hodges-Lehmann statistic is equivalent to the median of the pairwise differences between the observations in two groups.
Here is an example:
main.r285 chars13 lines
In this example, we generate two random samples from normal distributions with different means. We then apply the wilcox.test
function to compare the two samples and obtain the Hodges-Lehmann estimate. Finally, we print the results, which include the Hodges-Lehmann estimate and the full output of the wilcox.test
function.
gistlibby LogSnag