Learn R Programming

dsm (version 2.1.3)

dsm: Fit a density surface model to segment-specific estimates of abundance or density.

Description

Given a detection function analysis, construct a density surface model (DSM) based on environmental covariates.

Usage

dsm(formula, ddf.obj, segment.data, observation.data,
    engine = "gam", convert.units = 1,
    family = quasipoisson(link = "log"), group = FALSE,
    gamma = 1.4, control = list(keepData = TRUE),
    availability = 1, strip.width = NULL,
    segment.area = NULL, ...)

Arguments

formula
formula for the surface. This should be a valid glm/gam/gamm formula. See "Details", below, for how to define the
ddf.obj
result from call to ddf or ds. If ddf.obj is NULL then strip transects are assumed.
segment.data
segment data, see dsm-data.
observation.data
observation data, see dsm-data.
engine
which model should be used for the DSM (glm/gam/code{gamm}).
convert.units
value to alter length or width for calculation of the offset, applied to `segment.area` if used.
family
response distribution (popular choices include quasipoisson, Tweedie and negbin. Defaults to
group
should group abundance/density be modelled rather than individual abundance/density? This effectively sets the size column in observation.data to be 1.
control
the usual control argument for a gam, keepData must be TRUE or variance estimation will not work.
availability
an availability bias used to scale the counts/estimated counts by. If we have N animals in a segment, then N/availability will be entered into the model. Uncertainty in the availability is not handled at present.
gamma
parameter to gam() set to a value of 1.4 (from advice in Wood (2006)) such that the gam() is inclined to not 'overfit.'.
strip.width
if ddf.obj, above, is NULL, then this is where the strip width is specified. Note that this is the total width, i.e. right truncation minus left truncation.
segment.area
if `NULL` (default) segment areas will be calculated by multiplying the `Effort` column in `segment.data` by the truncation distance for the `ddf.obj` or by `strip.width`. Alternatively a vector of segment areas can be provided (which must be the
...
anything else to be passed straight to glm/gam/gamm.

Value

  • a glm/gam/gamm object, with an additional element, ddf which holds the detection function object.

Details

The response can be one of the following: ll{ N, abundance count in each segment Nhat, abundance.est estimated abundance per segment, estimation is via a Horvitz-Thompson estimator. This should be used when there are covariates in the detection function. presence interpret the data as presence/absence (reember to change the family argument to binomial() D, density density per segment }

References

Hedley, S. and S. T. Buckland. 2004. Spatial models for line transect sampling. JABES 9:181-199.

Miller, DL, ML Burt, EA Rexstad and L Thomas (2013). Spatial models for distance sampling data: recent developments and future directions. Methods in Ecology and Evolution. (http://dill.github.io/papers/dsm-paper.pdf)

Wood, S.N. 2006. Generalized Additive Models: An Introduction with R. CRC/Chapman & Hall.

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

# predict over a grid
mod1.pred <- predict(mod1, mexdolphins$preddata, off.set)

# calculate the predicted abundance over the grid
sum(mod1.pred)

# plot the smooth
plot(mod1)

Run the code above in your browser using DataLab