Description Usage Arguments Value Author(s) See Also Examples
Return a function performing kernel density estimation.
The difference between density
and
densityfun
is similar to that between
approx
and approxfun
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
x |
numeric. The data from which the estimate is to be computed. |
bw |
numeric. The smoothing bandwidth to be used.
See the eponymous argument of |
adjust |
numeric. The bandwidth used is actually |
kernel, window |
character. A string giving the smoothing kernel to be used.
Authorized kernels are listed in |
weights |
numeric. A vector of non-negative observation weights,
hence of same length as |
width |
this exists for compatibility with S;
if given, and |
n |
The number of equally spaced points at which the density
is to be estimated.
See the eponymous argument of |
from, to |
The left and right-most points of the grid at which the
density is to be estimated;
the defaults are |
cut |
By default, the values of |
na.rm |
logical. If |
... |
Additional arguments for (non-default) methods. |
A function that can be called to generate a density.
Adapted from the density
function of package stats.
The C code of BinDist
is copied from package stats and authored
by the R Core Team with contributions from Adrian Baddeley.
density
and approxfun
from package stats.
1 2 3 | x <- rlnorm(1000, 1, 1)
f <- densityfun(x, from = 0)
curve(f(x), xlim = c(0, 20))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.