powered by
Get a distribution function from a vector of values after applying some weights
weighted_ecdf(y, y.seq = NULL, weights = NULL, norm = TRUE)
ecdf
a vector to compute the mean for
an optional vector of values to compute the distribution function for; the default is to use all unique values of y
the vector of weights, can be NULL, then will just return mean
normalize the weights so that they have mean of 1, default is to normalize
y <- rnorm(100) w <- runif(100) F <- weighted_ecdf(y, weights = w) F(0) ## approx 0.5
Run the code above in your browser using DataLab