weighted_quantile: Weighted lower sample quantiles

Description Usage Arguments Details Value References See Also Examples

View source: R/robsurvey.R

Description

weighted_quantile computes the weighted lower sample quantile

Usage

1
weighted_quantile(x, w, probs, na.rm = FALSE)

Arguments

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 NA values should be stripped before the computation proceeds.

Details

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).

Value

Weighted sample quantiles

References

Cormen,T.H., Leiserson, C.E., Rivest, R.L., and Stein, C. (2009): Introduction to Algorithms, 3rd ed., Cambridge: MIT Press.

See Also

weighted_median

Examples

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))

martinSter/robsurvey documentation built on Oct. 11, 2019, 4:45 p.m.