contour {secr}R Documentation

Contour Detection Probability

Description

Display contours of the net probability of detection p.(X), or the area within a specified distance of detectors. bufferContour adds a conventional ‘boundary strip’ to a detector (trap) array, where buffer equals the strip width.

Usage


pdotContour(traps, border = NULL, nx = 64, detectfn = 0,
    detectpar = list(g0 = 0.2, sigma = 25, z = 1), noccasions = NULL,
    binomN = NULL, levels = seq(0.1, 0.9, 0.1), poly =
    NULL, poly.habitat = TRUE, plt = TRUE, add = FALSE, fill = NULL, ...)

bufferContour(traps, buffer, nx = 64, convex = FALSE, ntheta = 100,
     plt = TRUE, add = FALSE, poly = NULL, poly.habitat = TRUE, 
     fill = NULL, ...)

Arguments

traps

traps object (or mask for bufferContour)

border

width of blank margin around the outermost detectors

nx

dimension of interpolation grid in x-direction

detectfn

integer code or character string for shape of detection function 0 = halfnormal etc. – see detectfn

detectpar

list of values for named parameters of detection function

noccasions

number of sampling occasions

binomN

integer code for discrete distribution (see secr.fit)

levels

vector of levels for p.(X)

poly

matrix of two columns, the x and y coordinates of a bounding polygon (optional)

poly.habitat

logical as in make.mask

plt

logical to plot contours

add

logical to add contour(s) to an existing plot

fill

vector of colours to fill contours (optional)

...

other arguments to pass to contour

buffer

vector of buffer widths

convex

logical, if TRUE the plotted contour(s) will be convex

ntheta

integer value for smoothness of convex contours

Details

pdotContour constructs a rectangular mask and applies pdot to compute the p.(X) at each mask point.

If convex = FALSE, bufferContour constructs a mask and contours the points on the basis of distance to the nearest detector at the levels given in buffer.

If convex = TRUE, bufferContour constructs a set of potential vertices by adding points on a circle of radius = buffer to each detector location; the desired contour is the convex hull of these points (this algorithm derives from Efford, 2012).

If traps has a usage attribute then noccasions is set accordingly; otherwise it must be provided.

If traps is for multiple sessions then detectpar should be a list of the same length, one component per session, and noccasions may be a numeric vector of the same length.

Increase nx for smoother lines, at the expense of speed.

Value

Coordinates of the plotted contours are returned as a list with one component per polygon. The list is returned invisibly if plt = TRUE.

For multi-session input (traps) the value is a list of such lists, one per session.

Note

The precision (smoothness) of the fitted line in bufferContour is controlled by ntheta rather than nx when convex = TRUE.

To suppress contour labels, include the argument drawlabels = FALSE (this will be passed via ... to contour). Other useful arguments of contour are col (colour of contour lines) and lwd (line width).

You may wish to consider function st_buffer in package sf as an alternative to bufferContour.

bufferContour failed with multi-session traps before secr 2.8.0.

References

Efford, M. G. (2012) DENSITY 5.0: software for spatially explicit capture–recapture. Department of Mathematics and Statistics, University of Otago, Dunedin, New Zealand https://www.otago.ac.nz/density/.

See Also

pdot, make.mask

Examples


possumtraps <- traps(possumCH)

## convex and concave buffers
plot(possumtraps, border = 270)
bufferContour(possumtraps, buffer = 100, add = TRUE, col = "blue")
bufferContour(possumtraps, buffer = 100, convex = TRUE, add = TRUE)

## areas
buff.concave <- bufferContour(possumtraps, buffer = 100,
    plt = FALSE)
buff.convex  <- bufferContour(possumtraps, buffer = 100,
    plt = FALSE, convex = TRUE)
sum (sapply(buff.concave, polyarea)) ## sum over parts
sapply(buff.convex, polyarea)

## effect of nx on area
buff.concave2 <- bufferContour(possumtraps, buffer = 100,
    nx = 128, plt = FALSE)
sum (sapply(buff.concave2, polyarea))

## Not run: 

plot(possumtraps, border = 270)
pdotContour(possumtraps, detectfn = 0, nx = 128, detectpar =
    detectpar(possum.model.0), levels = c(0.1, 0.01, 0.001),
    noccasions = 5, add = TRUE)

## clipping to polygon
olddir <- setwd(system.file("extdata", package = "secr"))
possumtraps <- traps(possumCH)
possumarea <- read.table("possumarea.txt", header = TRUE)
par(xpd = TRUE, mar = c(1,6,6,6))
plot(possumtraps, border = 400, gridlines = FALSE)
pdotContour(possumtraps, detectfn = 0, nx = 256, detectpar =
    detectpar(possum.model.0), levels = c(0.1, 0.01, 0.001),
    noccasions = 5, add = TRUE, poly = possumarea, col = "blue")
lines(possumarea)
setwd(olddir)
par(xpd = FALSE, mar = c(5,4,4,2) + 0.1)    ## reset to default


## End(Not run)


[Package secr version 5.0.0 Index]