A variation of
ecdf() that can be applied to weighted samples.
weighted_ecdf(x, weights = NULL, na.rm = FALSE)
numeric vector: sample values
Weights for the sample. One of:
numeric vector of same length as
x: weights for corresponding values in
which will be normalized to sum to 1.
NULL: indicates no weights are provided, so the unweighted empirical
cumulative distribution function (equivalent to
ecdf()) is returned.
TRUE, corresponding entries in
are removed if either is
Generates a weighted empirical cumulative distribution function, \(F(x)\).
Given \(x\), a sorted vector (derived from
x), and \(w_i\), the corresponding
weight for \(x_i\), \(F(x)\) is a step function with steps at each \(x_i\)
with \(F(x_i)\) equal to the sum of all weights up to and including \(w_i\).