Density, distribution function, quantile function and random generation for a 'kde1d' kernel density estimate.
Arguments
- x
vector of density evaluation points.
- obj
a
kde1d
object.- q
vector of quantiles.
- p
vector of probabilities.
- n
integer; number of observations.
- quasi
logical; the default (
FALSE
) returns pseudo-random numbers, useTRUE
for quasi-random numbers (generalized Halton, seerandtoolbox::sobol()
).
Value
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.
Details
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.
Examples
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