Computes a weighted quantile of a numeric vector.
# S3 method for default
weightedQuantile(x, w, probs=c(0, 0.25, 0.5, 0.75, 1), na.rm=TRUE,
method=c("wtd.quantile"), ...)
a numeric vector
of weights the same length as
x
giving the weights to use for each element of x
.
Negative weights are treated as zero weights.
Default value is equal weight to all values.
If "wtd.quantile"
, then wtd.quantile
of the Hmisc package is used.
No other methods are currently supported.
Additional arguments passed to the estimator.
Returns the weighted quantile.
Internally the following functions may be used:
quantile
(if no weights are specified), or
wtd.quantile
.
For a weighted median estimator, weightedMedian
of the matrixStats package.