density and
densityfun is similar to that between
approx and approxfun.
densityfun(x, bw = "nrd0", adjust = 1, kernel = "gaussian", weights = NULL, window = kernel, width, n = 512, from, to, cut = 3, na.rm = FALSE, ...)density.adjust*bw.
This makes it easy to specify values like 'half the default' bandwidth..kernelsList().
See also the eponymous argument of density.x.
See the eponymous argument of density.bw is not,
will set bw to width
if this is a character string,
or to a kernel-dependent multiple of width if this is numeric.density.cut * bw outside of range(x).from and to
are cut bandwidths beyond the extremes of the data.
This allows the estimated density to drop to
approximately zero at the extremes.TRUE, missing values are removed
from x.
If FALSE any missing values cause an error.density and approxfun
from package stats.
x <- rlnorm(1000, 1, 1)
f <- densityfun(x, from = 0)
curve(f(x), xlim = c(0, 20))
Run the code above in your browser using DataLab