dsm {dsm} | R Documentation |

Fits a density surface model (DSM) to detection adjusted counts from a spatially-referenced distance sampling analysis. `dsm`

takes observations of animals, allocates them to segments of line (or strip transects) and optionally adjusts the counts based on detectability using a supplied detection function model. A generalized additive model, generalized mixed model or generalized linear model is then used to model these adjusted counts based on a formula involving environmental covariates.

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

`formula` |
formula for the surface. This should be a valid |

`ddf.obj` |
result from call to |

`segment.data` |
segment data, see |

`observation.data` |
observation data, see |

`engine` |
which fitting engine should be used for the DSM ( |

`convert.units` |
conversion factor to multiply the area of the segments by. See 'Units' below. |

`family` |
response distribution (popular choices include |

`group` |
if |

`control` |
the usual |

`availability` |
an estimate of availability bias. For count models used to multiply the effective strip width (must be a vector of length 1 or length the number of rows in |

`segment.area` |
if 'NULL' (default) segment areas will be calculated by multiplying the 'Effort' column in 'segment.data' by the (right minus left) truncation distance for the 'ddf.obj' or by 'strip.width'. Alternatively a vector of segment areas can be provided (which must be the same length as the number of rows in 'segment.data') or a character string giving the name of a column in 'segment.data' which contains the areas. If |

`weights` |
weights for each observation used in model fitting. The default, |

`method` |
The smoothing parameter estimation method. Default is |

`...` |

The response (LHS of 'formula') can be one of the following (with restrictions outlined below):

`count` | count in each segment |

`abundance.est` | estimated abundance per segment, estimation is via a Horvitz-Thompson estimator. |

`density.est` | density per segment |

The offset used in the model is dependent on the response:

count | area of segment multiplied by average probability of detection in the segment |

estimated count | area of the segment |

density | zero |

The `count`

response can only be used when detection function covariates only vary between segments/points (not within). For example, weather conditions (like visibility or sea state) or foliage cover are usually acceptable as they do not change within the segment, but animal sex or behaviour will not work. The `abundance.est`

response can be used with any covariates in the detection function.

In the density case, observations can be weighted by segment areas via the `weights=`

argument. By default (`weights=NULL`

), when density is estimated the weights are set to the segment areas (using `segment.area`

or by calculated from detection function object metadata and `Effort`

data). Alternatively `weights=1`

will set the weights to all be equal. A third alternative is to pass in a vector of length equal to the number of segments, containing appropriate weights.

A example analyses are available at http://examples.distancesampling.org.

a `glm`

/`gam`

/`gamm`

object, with an additional element, `ddf`

which holds the detection function object.

It is often the case that distances are collected in metres and segment lengths are recorded in kilometres. `dsm`

allows you to provide a conversion factor (`convert.units`

) to multiply the areas by. For example: if distances are in metres and segment lengths are in kilometres setting `convert.units=1000`

will lead to the analysis being in metres. Setting `convert.units=1/1000`

will lead to the analysis being in kilometres. The conversion factor will be applied to 'segment.area' if that is specified.

For large models, `engine="bam"`

with `method="fREML"`

may be useful. Models specified for `bam`

should be as `gam`

. READ `bam`

before using this option; this option is considered EXPERIMENTAL at the moment. In particular note that the default basis choice (thin plate regression splines) will be slow and that in general fitting is less stable than when using `gam`

. For negative binomial response, theta must be specified when using `bam`

.

David L. Miller

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

Miller, D. L., Burt, M. L., Rexstad, E. A., Thomas, L. (2013), Spatial models for distance sampling data: recent developments and future directions. Methods in Ecology and Evolution, 4: 1001-1010. doi: 10.1111/2041-210X.12105 (Open Access, available at http://onlinelibrary.wiley.com/doi/10.1111/2041-210X.12105/abstract)

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

## Not run: 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(distdata, max(distdata$distance), key = "hr", adjustment = NULL) summary(hr.model) # fit a simple smooth of x and y to counts mod1 <- dsm(count~s(x,y), hr.model, segdata, obsdata) summary(mod1) # predict over a grid mod1.pred <- predict(mod1, preddata, preddata$area) # calculate the predicted abundance over the grid sum(mod1.pred) # plot the smooth plot(mod1) ## End(Not run)

[Package *dsm* version 2.3.1 Index]