bootstrap functions {overlap} | R Documentation |
The strategy implemented involves three steps: 1. Create a matrix of bootstrap samples for each data set, using resample
. 2. Use bootEst
to calculate estimates for each bootstrap sample and create a matrix of bootstrap estimates. 3. Process the bootstrap estimates, eg. to produce confidence intervals with bootCI
.
resample(x, nb, smooth = TRUE, kmax = 3, adjust = 1, n.grid = 512) bootEst(Amat, Bmat, kmax = 3, adjust=c(0.8, 1, 4), n.grid = 128, type=c("all", "Dhat1", "Dhat4", "Dhat5"), cores=1)
x |
a numeric vector of time-of-capture data in radians, ie. on [0, 2π] scale |
nb |
the number of bootstrap samples required |
smooth |
if TRUE, smoothed bootstrap samples are produced. |
Amat, Bmat |
matrices of resampled data for each species produced by |
kmax |
maximum value of k for optimal bandwidth estimation. |
adjust |
bandwidth adjustment: see Details. |
n.grid |
number of points at which to estimate density for comparison between species; smaller values give lower precision but run faster in bootstraps. |
type |
the name of the estimator to use, or "all" to produce all three estimates. See |
cores |
the number of cores to use for parallel processing. If NA, all but one of the available cores will used. Parallel processing may take longer than serial processing if the bootstrap runs quickly. |
bandwidth adjustment:
for resample
, a single value.
for bootEst
, if type = "all"
, either a single value used for all 3 overlap estimates, or a vector of 3 different values; otherwise, a single value.
The function resample
returns a numeric matrix with each column corresponding to a bootstrap sample. Times are in radians. It may return a matrix of NAs if smooth = TRUE
and bandwidth estimation fails.
Function bootEst
with type = "all"
returns a numeric matrix with three columns, one for each estimator of overlap, otherwise a vector of bootstrap estimates. If bandwidth estimation fails for a bootstrap sample, the corresponding value will be NA.
Mike Meredith, including code by Martin Ridout.
Ridout & Linkie (2009) Estimating overlap of daily activity patterns from camera trap data. Journal of Agricultural, Biological, and Environmental Statistics 14:322-337
data(simulatedData) tigSim <- resample(tigerObs, 99) dim(tigSim) pigSim <- resample(pigObs, 99) boots <- bootEst(tigSim, pigSim) colMeans(boots) # or just do Dhat4 boots <- bootEst(tigSim, pigSim, type="Dhat4") mean(boots) # parallel processing takes longer for this example boots <- bootEst(tigSim, pigSim, type="Dhat4", cores=2) mean(boots)