# Uses stepSolve to find the one-sample Hodges-Lehmann estimate
if (FALSE) {
set.seed(1)
y<-rnorm(4)+7
wilcox.test(y,conf.int=TRUE,conf.level=.5)$estimate
f<-function(hl){wilcox.test(y-hl)$statistic-(length(y)*(1+length(y)))/4}
stepSolve(f,c(-100,100))
}
Run the code above in your browser using DataLab