Description Usage Arguments Details Value References See Also Examples
weighted_quantile
computes the weighted lower sample quantile
1 | weighted_quantile(x, w, probs, na.rm = FALSE)
|
x |
a numeric vector whose weighted sample quantiles are wanted |
w |
a numeric vector of weights |
probs |
a numeric vector of probabilities with values in [0,1] |
na.rm |
a logical value indicating whether |
Weighted lower quantiles are computed using an algorithm with O(n*log(n)) in worst-case time. There exist superior algorithms; see Cormen et al. (2009, Problem 9.2).
Weighted sample quantiles
Cormen,T.H., Leiserson, C.E., Rivest, R.L., and Stein, C. (2009): Introduction to Algorithms, 3rd ed., Cambridge: MIT Press.
1 2 | x <- c(0.1, 0.35, 0.05, 0.1, 0.15, 0.05, 0.2)
weighted_quantile(x, x, probs = c(0.25, 0.5, 0.75))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.