Computes the weighted mean, median and quantiles of a distribution.
weighted_stats(x, w, prob = c(0.05, 0.25, 0.75, 0.95))numeric vector with weighted mean, median and quantiles of size
2 + length(prob).
numeric vector of size n with the observations.
numeric vector of size n with non-negative weights. Note that this
vector needs to have the same length as the x vector.
numeric vector of probabilities with values in [0,1].
This function requires the MetricsWeighted::weighted_quantile() function
and the weights to compute the weighted arithmetic mean and the weighted
quantiles. By default, this function computes the 5%, 25%, 50% (corresponding
to the median), 75% and 95% quantiles.