powered by
function to recover quantiles of a vector with weights
weighted_quantile(tau, cvec, weights = NULL, norm = TRUE)
vector of quantiles
a vector of values between 0 and 1
a vector to compute quantiles for
the weights, weighted.checkfun normalizes the weights to sum to 1.
normalize the weights so that they have mean of 1, default is to normalize
y <- rnorm(100) w <- runif(100) weighted_quantile(c(0.25, 0.5, 0.75), y, weights = w)
Run the code above in your browser using DataLab