weighted_median: Weighted median with weighted interpolation
Description
weighted_median computes a weighted median where the
exact location corresponds exactly to a cumulative weight of 0.5.
This yields a symmetric median.
Usage
weighted_median(x, w, na.rm = FALSE)
Arguments
x
a numeric vector whose weighted sample median is wanted
w
a numeric vector of weights
na.rm
a logical value indicating whether NA values should be
stripped before the computation proceeds.
Value
weighted sample median
Details
Note that the weighted_median function delivers a symmetric
median while the weighted_quantile function with probability
0.5 delivers the lower median. Hence, the results of these two
functions will generally differ.