# dkernel

##### Kernel distributions and random generation

Density, distribution function, quantile function and random generation for several distributions used in kernel estimation for numerical data.

- Keywords
- methods, smooth, nonparametric

##### Usage

```
dkernel(x, kernel = "gaussian", mean = 0, sd = 1)
pkernel(q, kernel = "gaussian", mean = 0, sd = 1, lower.tail = TRUE)
qkernel(p, kernel = "gaussian", mean = 0, sd = 1, lower.tail = TRUE)
rkernel(n, kernel = "gaussian", mean = 0, sd = 1)
```

##### Arguments

- x, q
Vector of quantiles.

- p
Vector of probabilities.

- kernel
String name of the kernel. Options are

`"gaussian"`

,`"rectangular"`

,`"triangular"`

,`"epanechnikov"`

,`"biweight"`

,`"cosine"`

and`"optcosine"`

. (Partial matching is used).- n
Number of observations.

- mean
Mean of distribution.

- sd
Standard deviation of distribution.

- lower.tail
logical; if

`TRUE`

(the default), then probabilities are \(P(X \le x)\), otherwise, \(P(X > x)\).

##### Details

These functions give the probability density, cumulative distribution function, quantile function and random generation for several distributions used in kernel estimation for one-dimensional (numerical) data.

The available kernels are those used in `density.default`

,
namely `"gaussian"`

, `"rectangular"`

,
`"triangular"`

,
`"epanechnikov"`

,
`"biweight"`

,
`"cosine"`

and `"optcosine"`

.
For more information about these kernels,
see `density.default`

.

`dkernel`

gives the probability density,
`pkernel`

gives the cumulative distribution function,
`qkernel`

gives the quantile function,
and `rkernel`

generates random deviates.

##### Value

A numeric vector.
For `dkernel`

, a vector of the same length as `x`

containing the corresponding values of the probability density.
For `pkernel`

, a vector of the same length as `x`

containing the corresponding values of the cumulative distribution function.
For `qkernel`

, a vector of the same length as `p`

containing the corresponding quantiles.
For `rkernel`

, a vector of length `n`

containing randomly generated values.

##### See Also

##### Examples

```
# NOT RUN {
x <- seq(-3,3,length=100)
plot(x, dkernel(x, "epa"), type="l",
main=c("Epanechnikov kernel", "probability density"))
plot(x, pkernel(x, "opt"), type="l",
main=c("OptCosine kernel", "cumulative distribution function"))
p <- seq(0,1, length=256)
plot(p, qkernel(p, "biw"), type="l",
main=c("Biweight kernel", "cumulative distribution function"))
y <- rkernel(100, "tri")
hist(y, main="Random variates from triangular density")
rug(y)
# }
```

*Documentation reproduced from package spatstat, version 1.55-1, License: GPL (>= 2)*