Learn R Programming

fdrtool (version 1.1.0)

grenader: Grenander Estimator of a Decreasing Density

Description

The function grenander computes the Grenander estimator of a one-dimensional decreasing density.

Usage

grenander(F)

Arguments

F
an ecdf containing the empirical cumulative density.

Value

  • A list of class grenander with the following components:
  • Fthe empirical distribution function specified as input.
  • x.knotsx locations of the knots of the least concave majorant of the ECDF.
  • F.knotsthe corresponding y locations of the least concave majorant of the ECDF.
  • f.knotsthe corresponding slopes (=density).

Details

The Grenander (1956) density estimator is given by the slopes of the least concave majorant (LCM) of the empirical distribution function (ECDF). It is a decreasing piecewise-constant function and can be shown to be the non-parametric maximum likelihood estimate (NPMLE) under the assumption of a decreasing density (note that the ECDF is the NPMLE without this assumption).

References

Grenander, U. (1956). On the theory of mortality measurement, Part II. Skan. Aktuarietidskr, 39, 125--153.

See Also

ecdf, gcmlcm, density.

Examples

Run this code
# load "fdrtool" library
library("fdrtool")

# samples from random exponential variable 
z = rexp(30,1)
e = ecdf(z)
g = grenander(e)
g
plot(g) # plot ecdf, concave cdf, and Grenander estimator

# for comparison the kernel density estimate
plot(density(z)) 

# area under the Grenander density estimator 
sum( g$f.knots[-length(g$f.knots)]*diff(g$x.knots) )

Run the code above in your browser using DataLab