grenander {modeest}R Documentation

Grenander Mode Estimator

Description

This function computes the Grenander mode estimator.

Usage

grenander(x, 
          bw = NULL, 
          k, 
          p, 
          ...)

Arguments

x numeric. Vector of observations.
bw numeric. The bandwidth to be used. Should belong to (0, 1].
k numeric. Paramater 'k' in Grenander mode estimate.
p numeric. Paramater 'p' in Grenander mode estimate. If p = Inf, function venter is used.
... further arguments to be passed to link{venter}

Details

The Grenander estimate is defined by

( sum_{j=1}^{n-k} (x_{j+k} + x_{j})/(2(x_{j+k} - x_{j})^p) ) / ( sum_{j=1}^{n-k} 1/((x_{j+k} - x_{j})^p) )

If p tends to infinity, this estimate tends to Venter mode estimate; this justifies to call venter if p = Inf.

The user should either give the bandwidth bw or the argument k, k being taken equal to ceiling(bw*ny) - 1 if missing.

Value

A numeric value is returned, the mode estimate. If p = Inf, the Venter mode estimator is returned.

Note

The user should preferentially call grenander through mlv(x, method = "grenander", bw, k, p, ...). This returns an object of class mlv.

Author(s)

D.R. Bickel for the original code,
Paul Poncet paulponcet@yahoo.fr for the slight modifications introduced.

References

See Also

mlv for general mode estimation; venter for the Venter mode estimate

Examples

# Unimodal distribution
x <- rnorm(1000, mean = 23, sd = 0.5)
## True mode
normMode(mean = 23, sd = 0.5) # (!)
## Parameter 'k'
k <- 5
## Many values of parameter 'p'
p <- seq(0.1, 4, 0.01)
## Estimate of the mode with these parameters
M <- sapply(p, function(pp) grenander(x, p = pp, k = k))
## Distribution obtained
plot(density(M), xlim = c(22.5, 23.5))

[Package modeest version 1.06 Index]