safeKDE: safeKDE(x,classes,kdeClass)

Description Usage Arguments Value Author(s) Examples

View source: R/safeKDE.R

Description

Function purpose is to create kernel density estimates for a given vector of data. Function handles errors seen when the data has a variance of zero. A vector of categorical 'group' levels can be provided (grps input), along with a level

Usage

1
safeKDE(x, classes = NULL, kdeClass = NULL)

Arguments

x

A vector of values for which a KDE will be created (either for the entire x vector, or for just the specified kdeClass, depending on inputs.)

classes

A vector of categorical class values for vector x. Length must equal length(x).

kdeClass

The class within classes for which a kde should be created. If classes and kdeclass are not populated, a kde is created for the entire x vector.

Value

ks A list object with three components.

ks$eval.points The x values for the kde estimate.

ks$estimate The y values for the kde estimate.

ks$h The bandwidth for the kde estimate.

Author(s)

Jennifer Starling

Examples

1
2
##data is a data frame containing a column named 'class'.
p <- classProps(data)

jstarling1/starlib documentation built on May 20, 2019, 2:12 a.m.