bootstrap: Perform bootstrap iterations

View source: R/bootstrap.R

bootstrapR Documentation

Perform bootstrap iterations

Description

Performs bootstrap resampling iterations, either in parallel across CPU cores or in serial on a single core.

Usage

bootstrap(
  object,
  area,
  propUnitSurveyed,
  R,
  plot.bs,
  plotCovValues,
  showProgress,
  parallel,
  cores
)

Arguments

object

An Rdistance model frame or fitted distance function, normally produced by a call to dfuncEstim.

area

A scalar containing the total area of inference. Usually, this is study area size. If area is NULL (the default), area will be set to 1 square unit of the output units and density estimates will be produced. If area is not NULL, it must have measurement units assigned by the units package. The units on area must be convertible to squared output units. Units on area must be two-dimensional. For example, if output units are "foo", units on area must be convertible to "foo^2" by the units package. Units of "km^2", "cm^2", "ha", "m^2", "acre", "mi^2", and several others are acceptable.

propUnitSurveyed

A scalar or vector of real numbers between 0 and 1. The proportion of the default sampling unit that was surveyed. If both sides of line transects were observed, propUnitSurveyed = 1. If only a single side of line transects were observed, set propUnitSurveyed = 0.5. For point transects, this should be set to the proportion of each circle that was observed. Length must either be 1 or the total number of transects in x.

R

The number of bootstrap iterations to conduct when ci is not NULL.

plot.bs

A logical scalar indicating whether to plot individual bootstrap iterations. Ignored unless parallel = FALSE.

plotCovValues

Data frame containing values of covariates to plot. Ignored if plot.bs is FALSE.

showProgress

A logical indicating whether to show a text-based progress bar during bootstrapping. Default is TRUE. It is handy to shut off the progress bar if running this within another function. Ignored unless parallel = FALSE.

parallel

Logical scalar. TRUE if we are running iterations in parallel across CPU cores. Number of cores specified in cores.

cores

Integer scalar. The number of CPU cores to use during parallel operations, if requested. Ignored if parallel == FALSE.

Value

A data frame containing density, abundance, and other relevant statistics for every bootstrap iteration. Number of rows is R. If the model from one iteration failed for any reason (e.g., non-convergence), the entire row except the ID column is missing.

See Also

abundEstim; oneBsIter


Rdistance documentation built on Jan. 10, 2026, 1:07 a.m.