#' @rdname kde_1d
#' @export
kernelEpanechnikov <- function(x, mean = 0, sd = 1)
h <- sqrt(5)*sd
ifelse((z <- abs(x-mean)) < h, 3/4*(1 - (z/h)^2)/h, 0)
#' @rdname kde_1d
#' @export
kernelGaussian <- function(x, mean = 0, sd = 1)
dnorm(x, mean = mean, sd = sd)
#' @rdname kde_1d
#' @export
kernelLogistic <- function(x, mean = 0, sd = 1)
stats::dlogis(x, mean, sqrt(3)/pi*sd)
#' @rdname kde_1d
#' @export
kernelOptCosine <- function(x, mean = 0, sd = 1)
h <- sqrt(1/(1-8/pi^2))*sd
ifelse((z <- abs(x-mean)) < h, pi/4*cos((pi*z)/(2*h))/h, 0)
#' @rdname kde_1d
#' @export
kernelRectangular <- function(x, mean = 0, sd = 1)
h <- sqrt(3)*sd
ifelse(abs(x-mean) < h, 1/(2*h), 0)
#' @rdname kde_1d
#' @export
kernelSquaredCosine <- function(x, mean = 0, sd = 1)
h <- sqrt(3/(1-6/pi^2))*sd
ifelse((z <- abs(x-mean)) < h, cos(pi*z/(2*h))^2/h, 0)
#' @rdname kde_1d
#' @export
kernelTriangular <- function(x, mean = 0, sd = 1)
h <- sqrt(24)*sd/2
ifelse((z <- abs(x-mean)) < h, (1 - z/h)/h, 0)
#' @rdname kde_1d
#' @export
kernelTricube <- function(x, mean = 0, sd = 1)
h <- sqrt(243/35)*sd
ifelse((z <- abs(x - mean)) < h, 70/81*(1 - (z/h)^3)^3/h, 0)
#' @rdname kde_1d
#' @export
kernelTriweight <- function(x, mean = 0, sd = 1)
h <- sqrt(9)*sd
ifelse((z <- abs(x-mean)) < h, 35/32*(1 - (z/h)^2)^3/h, 0)
#' @rdname kde_1d
#' @export
kernelUniform <- function(x, mean = 0, sd = 1)
h <- sqrt(3)*sd
ifelse(abs(x-mean) < h, 1/(2*h), 0)
Home Range levels
For an object representing a 2-dimensional kernel density estimate
find the level(s) defining a central "home range" region, that is,
a region of probability content p for which all density points
within the region are higher than any density point outside the region.
This makes it a region of probability p with smallest area.