Learn R Programming

dsm (version 2.1.3)

dsm.var.movblk: Variance estimation via parametric moving block bootstrap

Description

Estimate the variance in abundance over an area using a moving block bootstrap. Two procedures are implemented, one incorporating detection function uncertainty, one not.

Usage

dsm.var.movblk(dsm.object, pred.data, n.boot, block.size,
    off.set, ds.uncertainty = FALSE,
    samp.unit.name = "Transect.Label",
    progress.file = NULL, bs.file = NULL, bar = TRUE)

Arguments

dsm.object
object returned from dsm.
pred.data
a data.frame that holds prediction points, must have the correct columns for other environmental covariates. It also MUST have a column called cell.area which gives the area for each prediction cell
n.boot
number of bootstrap resamples.
block.size
number of segments in each block.
off.set
offset to be used in the model, see offsets. Note that this should NOT be log()'d.
ds.uncertainty
incorporate uncertainty in the detection function? See Details, below. Note that this feature is EXPERIMENTAL at the moment.
samp.unit.name
name sampling unit to resample (default 'Transect.Label').
progress.file
path to a file to be used (usually by Distance) to generate a progress bar (default NULL -- no file written).
bs.file
path to a file to store each boostrap round. This stores all of the bootstrap results rather than just the summaries, enabling outliers to be detected and removed. (Default NULL).
bar
should a progress bar be printed to screen? (Default TRUE).

Details

Setting ds.uncertainty=TRUE will incorporate detection function uncertainty directly into the bootstrap. This is done by generating observations from the fitted detection function and then re-fitting a new detection function (of the same form), then calculating a new effective strip width. Rejection sampling is used to generate the observations (except in the half-normal case) so the procedure can be rather slow. Note that this is currently not supported with covariates in the detection function.

Setting ds.uncertainty=FALSE will incorporate detection function uncertainty using the delta method. This assumes that the detection function and the spatial model are INDEPENDENT. This is probably not reasonable.

Examples

Run this code
library(Distance)
library(dsm)

# load the Gulf of Mexico dolphin data (see ?mexdolphins)
data(mexdolphins)

# fit a detection function and look at the summary
hr.model <- ds(mexdolphins$distdata, max(mexdolphins$distdata$distance),
               key = "hr", adjustment = NULL)
summary(hr.model)

# fit a simple smooth of x and y
mod1<-dsm(N~s(x,y), hr.model, mexdolphins$segdata, mexdolphins$obsdata)
summary(mod1)

# create an offset (in metres)
# each prediction cell is 444km2
off.set <- 444*1000*1000

# calculate the variance by 500 moving block bootstraps
mod1.movblk <- dsm.var.movblk(mod1, mexdolphins$preddata, n.boot = 500,
   block.size = 3, samp.unit.name = "Transect.Label", off.set = off.set,
   bar = TRUE, bs.file = "mexico-bs.csv", ds.uncertainty = TRUE)

Run the code above in your browser using DataLab