x=rnorm(5) ############################ Hodges and Lehmann Estimator hl=function(x) { c=1; yy=c() for(i in 1:length(x)) { for(j in 1:length(x)) { yy[c]=(x[i]+x[j])/2 # Walsh averages c=c+1 } } hlehm=median(yy) ####Hodges and Lehmann Estimator return(hlehm) } ######################################## Trimean trimn=function(x) { trm=(quantile(x,0.25,type=6)+2*quantile(x,0.50,type=6)+quantile(x,0.75,type=6))/4 return(trm) } OR tm=function(x) { ordstats = quantile(x, probs=c(0.25,1/2,1/2,0.75)) trm=mean(ordstats) return(trm) } ####################################### Gast Wirth Estimator Gastwirth = function(x){ ordstats = quantile(x, probs=c(1/3,1/2,2/3)) wts = c(0.3,0.4,0.3) sum(wts*ordstats) } ########################################### Mid Range midr=function(x) { midran=(max(x)+min(x))/2 return(midran) }