View source: R/activity_code.r
density2 | R Documentation |
Modifies stats::density
by:
Adding SE and 95% confidence intervals for the density to the output; and
Truncating calculation (not just reporting) of density values on from and/or to.
density2(x, reps = 999, ...)
x |
numeric data vector |
reps |
bootstrap iterations for SE/interval calculation; set to NULL to suppress |
... |
Additional arguments passed to |
Truncation copes with cases where no data are available outside truncation points. Truncation is achieved by fitting the density to the data augmented by reflecting it across each bound using the optimal bandwidth for the unaugmented data, and returning the resulting densities for the region between the bounds.
A list with the same components as stats::density
output plus:
se
: standard error of the density
lcl
, ucl
: lower and upper 95% confidence intervals of the density
data(BCItime)
tm <- subset(BCItime, species=="ocelot")$time
dens <- density2(tm, from=0.25, to=0.75)
plot(dens$x, dens$y, type="l")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.