weightedQuantile: Weighted Quantile Value

weightedQuantileR Documentation

Weighted Quantile Value

Description

Computes a weighted quantile of a numeric vector.

Usage

## Default S3 method:
weightedQuantile(x, w, probs=c(0, 0.25, 0.5, 0.75, 1), na.rm=TRUE,
  method=c("wtd.quantile"), ...)

Arguments

x

a numeric vector containing the values whose weighted quantile is to be computed.

w

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.

probs

a numeric vector of quantiles in [0,1] to be retrieved.

na.rm

a logical value indicating whether NA values in x should be stripped before the computation proceeds, or not.

method

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.

Value

Returns the weighted quantile.

Author(s)

Henrik Bengtsson

See Also

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.


HenrikBengtsson/PSCBS documentation built on Feb. 20, 2024, 9:01 p.m.