kdemode: Mode estimation via KDE

Description Usage Arguments Value Author(s) References Examples

View source: R/kdemode.R

Description

Return mode of a vector as calculated using KDE.

Usage

1
2
kdemode(data,type=c("diffusion","SJ","nrd0"),
        weights=NULL,from=NULL,to=NULL,outplot=c(FALSE,TRUE),...)

Arguments

data

One-dimensional vector of data.

type

Bandwidth selection: 1. "diffusion": Kernel Density Estimation Via Diffusion, Botev el al. 2010; 2. SJ: Sheater and Jones method; 3. nrd0: Silverman heuristic.

weights

Numeric vector of non-negative observation weights, of the same length as data.

from

Lower bound of values for KDE estimation. By default this is min(data)-0.1*diff(range(data)).

to

Upper bound of values for KDE estimation. By default this is max(data)+0.1*diff(range(data)).

outplot

If TRUE provides plot of the KDE and the mean, median and mode.

...

Additional arguments can be passed to plotting functions. For example use main="" to replace the title.

Value

mode

Estimated mode value.

xd

Estimated values.

fd

Estimated density.

h

BAndwidth.

Author(s)

Nikolaos Kourentzes

References

Kourentzes, Nikolaos, Devon K. Barrow, and Sven F. Crone. "Neural network ensemble operators for time series forecasting." Expert Systems with Applications 41.9 (2014): 4235-4244.

Botev, Z. I., J. F. Grotowski, and D. P. Kroese. "Kernel density estimation via diffusion." The Annals of Statistics 38.5 (2010): 2916-2957.

Examples

1
2
data <- rnorm(200,mean=0,sd=1)
kdemode(data,outplot=TRUE)

trnnick/TStools documentation built on Sept. 14, 2019, 5:22 a.m.