weightedMedian {robcp} | R Documentation |
Weighted Median
Description
Computes the weighted median of a numeric vector.
Usage
weightedMedian(x, w)
Arguments
x |
Numeric vector. |
w |
Integer vector of weights. |
Details
Here, the median of an even length n
of x
is defined as x_{(n/2 + 1)}
if x_{(i)}
is the i
-th largest element in x
, i.e. the larger value is taken.
Value
Weighted median of x with respect to w.
Examples
x <- c(1, 4, 9)
w <- c(5, 1, 1)
weightedMedian(x, w)
[Package robcp version 0.3.9 Index]