mean.ewcdf | R Documentation |
Calculates the mean of a (weighted or unweighted) empirical cumulative distribution function.
## S3 method for class 'ecdf'
mean(x, trim=0, ...)
## S3 method for class 'ewcdf'
mean(x, trim=0, ...)
x |
An empirical cumulative distribution function
(object of class |
trim |
The fraction (0 to 0.5) of data values to be trimmed from each end of their range, before the mean is computed. |
... |
Ignored. |
These functions are methods for the generic
mean
for the classes "ecdf"
and "ewcdf"
.
They calculate the mean of the probability distribution
corresponding to the cumulative distribution function x
.
This is equivalent to calculating the (weighted or unweighted)
mean of the original data values.
For weighted empirical cumulative distribution functions
(class "ewcdf"
) the weights will first be normalised so that they
sum to 1. The result of mean.ewcdf
is always an average or weighted average or the original data values.
The argument trim
is interpreted as a probability
under this normalised distribution; the corresponding
quantiles are computed, and data outside these quantiles is deleted
before calculating the weighted mean.
A single number.
.
Generic mean
and
weighted.mean
.
ecdf
, ewcdf
to create the cumulative distribution functions.
stieltjes
for integration with respect to
a cumulative distribution function.
x <- 1:5
mean(x)
mean(ecdf(x))
w <- 1:5
mean(ewcdf(x, w))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.