weighted.quantile()
produces weighted sample quantiles corresponding to the given probabilities.
Usage
weighted.quantile(
x,
w = NULL,
probs = seq(0, 1, 0.25),
na.rm = FALSE,
names = TRUE,
digits = 7L,
type = 1L,
...
)
Arguments
- x
a numeric vector whose weighted sample quantiles are wanted.
- w
a numeric vector of the sample weights for each value in
x
.- probs
a numeric vector of probabilities with values in
[0, 1]
.- na.rm
logical. If
TRUE
, anyNA
andNaN
s are removed fromx
before the quantiles are computed.- names
logical. If
TRUE
, the result has a "names" attribute.- digits
used only when
names
isTRUE
. The precision to use when formatting the percentages.- type
an integer between
1
and9
selecting the quantile algorithms. Only1
is available for the weighted quantile.- ...
further arguments passed to
stats::quantile()
when the weights is not passed.
Value
weighted.quantile()
returns weighted sample quantiles corresponding to the given probabilities.
Details
weighted.quantile()
is a wrapper function of stats::quantile()
for weighted quantiles.
For the weighted quantile, only the "type 1" quantile, the inverse of the empirical distribution function, is available.