ewcdf(x, weights = rep(1/length(x), length(x)))
x
."ecdf"
, inheriting from "stepfun"
.ecdf
allowing the observations x
to have weights. The weighted e.c.d.f. (empirical cumulative distribution function)
Fn
is defined so that, for any real number y
, the value of
Fn(y)
is equal to the total weight of all entries of
x
that are less than or equal to y
. That is
Fn(y) = sum(weights[x <= y])<="" code="">.
Thus Fn
is a step function which jumps at the
values of x
. The height of the jump at a point y
is the total weight of all entries in x
number of tied observations at that value. Missing values are
ignored.
If weights
is omitted, the default is equivalent to
ecdf(x)
.
ecdf
x <- rnorm(100)
w <- runif(100)
plot(ewcdf(x,w))
Run the code above in your browser using DataLab