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"), ...)
Returns the weighted quantile.
a numeric
vector
containing the values whose weighted
quantile is to be computed.
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.
a logical
value indicating whether NA
values in
x
should be stripped before the computation proceeds,
or not.
If "wtd.quantile"
, then an internal copy of
Hmisc::wtd.quantile()
is used.
No other methods are currently supported.
Additional arguments passed to the estimator.
Henrik Bengtsson
Internally the following functions may be used:
quantile
(if no weights are specified), or an internal
copy of Hmisc::wtd.quantile()
.
For a weighted median estimator, weightedMedian
of the matrixStats package.