Learn R Programming

unmarked (version 1.5.0)

nonparboot: Get non-parametric bootstrap samples from an unmarked model

Description

Resamples sites (with replacement) from an unmarkedFit object and re-fits the model, to generate new non-parametric bootstrap samples of estimates. These samples can then be used by vcov in order to get bootstrap-based estimates of standard errors.

Usage

# S4 method for unmarkedFit
nonparboot(object, B = 1, keepOldSamples = TRUE, ...)

Arguments

object

A unmarkedFit object

B

The number of bootstrap samples to get

keepOldSamples

Should previously generated bootstrap samples be retained?

...

Other arguments, currently ignored

Details

Calling nonparboot on an unmarkedFit returns the original unmarkedFit, with the bootstrap samples added on. Then subsequent calls to vcov with the argument method="nonparboot" will use these bootstrap samples. Additionally, standard errors of derived estimates from either linearComb or backTransform can be instructed to use bootstrap samples by providing the argument method = "nonparboot".

For all fitting functions, only sites are re-sampled. In previous versions of unmarked both sites and occasions of occu and occuRN fits were re-sampled, but now only sites are re-sampled for these fit types to match the other fit types.

Note: by default, if the model fit to a new resampled dataset results in an error or a convergence failure, nonparboot will continually re-sample and re-fit until this is no longer the case. This could result in the function hanging.

Examples

Run this code
data(ovendata)
ovenFrame <- unmarkedFrameMPois(ovendata.list$data,
siteCovs=as.data.frame(scale(ovendata.list$covariates[,-1])), type = "removal")
(fm <- multinomPois(~ 1 ~ ufc + trba, ovenFrame))
fm <- nonparboot(fm, B = 20) # should use larger B in real life.
vcov(fm, method = "hessian")
vcov(fm, method = "nonparboot")
avg.abundance <- backTransform(linearComb(fm, type = "state", coefficients = c(1, 0, 0)))

## Bootstrap sample information propagates through to derived quantities.
vcov(avg.abundance, method = "hessian")
vcov(avg.abundance, method = "nonparboot")
SE(avg.abundance, method = "nonparboot")

Run the code above in your browser using DataLab