dkernel | R Documentation |
Density, distribution function, quantile function and random generation for several distributions used in kernel estimation for numerical data.
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)
x , q |
Vector of quantiles. |
p |
Vector of probabilities. |
kernel |
String name of the kernel.
Options are
|
n |
Number of observations. |
mean |
Mean of distribution. |
sd |
Standard deviation of distribution. |
lower.tail |
logical; if |
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.
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.
and \martinH.
density.default
,
kernel.factor
,
kernel.moment
,
kernel.squint
.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.