R: Mean of Empirical Cumulative Distribution Function

mean.ewcdf {spatstat.geom} | R Documentation

## Mean of Empirical Cumulative Distribution Function

### Description

Calculates the mean of a (weighted or unweighted) empirical cumulative distribution function.

### Usage

    ## S3 method for class 'ecdf'
    mean(x, trim=0, ...)

    ## S3 method for class 'ewcdf'
    mean(x, trim=0, ...)

### Arguments

`x` | An empirical cumulative distribution function (object of class `"ecdf"` created by `ecdf`) or a weighted empirical cumulative distribution function (object of class `"ewcdf"` created by `ewcdf`).
`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.

### Details

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.

### Value

A single number.

### Author(s)

Adrian Baddeley Adrian.Baddeley@curtin.edu.au, Rolf Turner r.turner@auckland.ac.nz and Ege Rubak rubak@math.aau.dk.

### See Also

Generic `mean` and `weighted.mean`.

`ecdf`, `ewcdf` to create the cumulative distribution functions.

`stieltjes` for integration with respect to a cumulative distribution function.

### Examples

      x <- 1:5
      mean(x)
      mean(ecdf(x))
      w <- 1:5
      mean(ewcdf(x, w))

[Package spatstat.geom version 2.3-2 Index]