Description Usage Arguments Summary Functions Model selection See Also Examples
Performs a bootstrap for simple distance sampling models using the same data structures as dht
.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
model |
a model fitted by |
flatfile |
Data provided in the flatfile format. See |
resample_strata |
should resampling happen at the stratum ( |
resample_obs |
should resampling happen at the observation ( |
resample_transects |
should resampling happen at the transect ( |
nboot |
number of bootstrap replicates |
summary_fun |
function that is used to obtain summary statistics from the bootstrap, see Summary Functions below. By default |
convert.units |
conversion between units for abundance estimation, see "Units", below. (Defaults to 1, implying all of the units are "correct" already.) This takes precedence over any unit conversion stored in |
select_adjustments |
select the number of adjustments in each bootstrap, when |
sample_fraction |
what proportion of the transects was covered (e.g., 0.5 for one-sided line transects). |
progress_bar |
which progress bar should be used? Default "base" uses |
The function summary_fun
allows the user to specify what summary statistics should be recorded from each bootstrap. The function should take two arguments, ests
and fit
. The former is the output from dht2
, giving tables of estimates. The latter is the fitted detection function object. The function is called once fitting and estimation has been performed and should return a data.frame
. Those data.frame
s are then concatenated using rbind
. One can make these functions return any information within those objects, for example abundance or density estimates or the AIC for each model. See Examples below.
Model selection can be performed on a per-replicate basis within the bootstrap. This has three variations:
when select_adjustments
is TRUE
then adjustment terms are selected by AIC within each bootstrap replicate (provided that model
had the order
and adjustment
options set to non-NULL
.
if model
is a list of fitted detection functions, each of these is fitted to each replicate and results generated from the one with the lowest AIC.
when select_adjustments
is TRUE
and model
is a list of fitted detection functions, each model fitted to each replicate and number of adjustments is selected via AIC.
The last of these options can be very time consuming!
summary.dht_bootstrap
for how to summarize the results, bootdht_Nhat_summarize
for an example summary function.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ## Not run:
# fit a model to the minke data
data(minke)
mod1 <- ds(minke)
# summary function to save the abundance estimate
Nhat_summarize <- function(ests, fit) {
return(data.frame(Nhat=ests$individuals$N$Estimate))
}
# perform 5 bootstraps
bootout <- bootdht(mod1, flatfile=minke, summary_fun=Nhat_summarize, nboot=5)
# obtain basic summary information
summary(bootout)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.