R/kernels.q

Defines functions triangular rectangular epanechnikov biweight

Documented in biweight epanechnikov rectangular triangular

biweight <- function(x)
{
  ans <- numeric(length(x))
  index <- abs(x) < 1
  ans[index] <- 15 * (1 - x[index]^2)^2 / 16
  ans
}


epanechnikov <- function(x)
{
  ans <- numeric(length(x))
  index <- abs(x) < sqrt(5)
  ans[index] <- 3 * (1 - 0.2*x[index]^2) / (4 * sqrt(5))
  ans
}


rectangular <- function(x)
{
  ans <- numeric(length(x))
  index <- abs(x) < 1
  ans[index] <- 0.5
  ans
}


triangular <- function(x)
{
  ans <- numeric(length(x))
  index <- abs(x) < 1
  ans[index] <- 1 - abs(x[index])
  ans
}

Try the bpkde package in your browser

Any scripts or data that you put into this service are public.

bpkde documentation built on May 30, 2017, 1:52 a.m.