parzen: Parzen's Kernel mode estimator

Description Usage Arguments Details Value Note References See Also Examples

View source: R/parzen.R

Description

Parzen's kernel mode estimator is the value maximizing the kernel density estimate.

Usage

1
2
3
4
5
6
7
8
parzen(
  x,
  bw = NULL,
  kernel = "gaussian",
  abc = FALSE,
  tolerance = .Machine$double.eps^0.25,
  ...
)

Arguments

x

numeric. Vector of observations.

bw

numeric. The smoothing bandwidth to be used.

kernel

character. The kernel to be used. For available kernels see densityfun in package statip.

abc

logical. If FALSE (the default), the kernel density estimate is maximised using optim.

tolerance

numeric. Desired accuracy in the optimize function.

...

If abc = FALSE, further arguments to be passed to optim.

Details

If kernel = "uniform", the naive mode estimate is returned.

Value

parzen returns a numeric value, the mode estimate. If abc = TRUE, the x value maximizing the density estimate is returned. Otherwise, the optim method is used to perform maximization, and the attributes: 'value', 'counts', 'convergence' and 'message', coming from the optim method, are added to the result.

Note

The user may call parzen through mlv(x, method = "kernel", ...) or mlv(x, method = "parzen", ...).

Presently, parzen is quite slow.

References

See Also

mlv, naive

Examples

1
2
3
4
5
6
7
8
# Unimodal distribution 
x <- rlnorm(10000, meanlog = 3.4, sdlog = 0.2) 

## True mode 
lnormMode(meanlog = 3.4, sdlog = 0.2) 

## Estimate of the mode 
mlv(x, method = "kernel", kernel = "gaussian", bw = 0.3, par = shorth(x)) 

paulponcet/modeest documentation built on Nov. 19, 2019, 9:16 p.m.