Weighted Hi-Median
Compute the weighted Hi-Median of x
.
wgt.himedian(x, weights = rep(1, n))
x
: numeric vectorweights
: numeric vector of weights; of the same length as x
.this is rather a by-product of the code used in Sn
and Qn
. We currently plan to replace it with more general weighted quantiles.
median
;
also wtd.quantile
from package list("Hmisc").
x <- c(1:6, 20) median(x) ## 4 stopifnot(all.equal(4, wgt.himedian(x)), all.equal(6, wgt.himedian(x, c(rep(1,6), 5))))
Useful links