Density, distribution function, quantile function and random generation for a 'kde1d' kernel density estimate.
dkde1d(x, obj)
pkde1d(q, obj)
qkde1d(p, obj)
rkde1d(n, obj, quasi = FALSE)
vector of density evaluation points.
a kde1d
object.
vector of quantiles.
vector of probabilities.
integer; number of observations.
logical; the default (FALSE
) returns pseudo-random
numbers, use TRUE
for quasi-random numbers (generalized Halton, see
randtoolbox::sobol()
).
The density, distribution function or quantile functions estimates
evaluated respectively at x
, q
, or p
, or a sample of n
random
deviates from the estimated kernel density.
dkde1d()
gives the density, pkde1d()
gives
the distribution function, qkde1d()
gives the quantile function,
and rkde1d()
generates random deviates.
The length of the result is determined by n
for rkde1d()
, and
is the length of the numerical argument for the other functions.
set.seed(0) # for reproducibility
x <- rnorm(100) # simulate some data
fit <- kde1d(x) # estimate density
dkde1d(0, fit) # evaluate density estimate (close to dnorm(0))
#> [1] 0.4495823
pkde1d(0, fit) # evaluate corresponding cdf (close to pnorm(0))
#> [1] 0.5008513
qkde1d(0.5, fit) # quantile function (close to qnorm(0))
#> [1] -0.001893213
hist(rkde1d(100, fit)) # simulate