robustbase (version 0.93-6)

wgt.himedian: Weighted Hi-Median

Description

Compute the weighted Hi-Median of x.

Usage

wgt.himedian(x, weights = rep(1, n))

Arguments

x

numeric vector

weights

numeric vector of weights; of the same length as x.

See Also

median; also wtd.quantile from package Hmisc.

Examples

Run this code
# NOT RUN {
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))))
# }

Run the code above in your browser using DataCamp Workspace