weighted.quantile {midr} | R Documentation |
Weighted Sample Quantile
Description
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 |
probs |
a numeric vector of probabilities with values in |
na.rm |
logical. If |
names |
logical. If |
digits |
used only when |
type |
an integer between |
... |
further arguments passed to |
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.
Value
weighted.quantile()
returns weighted sample quantiles corresponding to the given probabilities.
Examples
stats::quantile(x = 1:10, type = 1L, probs = c(0, .25, .50, .75, 1))
weighted.quantile(x = 1:10, w = 1:10, probs = c(0, .25, .50, .75, 1))