
buffer.contour
adds a conventional `boundary strip' to a detector (trap) array, where
buffer
equals the strip width.pdot.contour(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, plt = TRUE, add = FALSE, ...)
buffer.contour(traps, buffer, nx = 64, convex = FALSE, ntheta = 100,
plt = TRUE, add = FALSE, poly = NULL, ...)
traps
objectsecr.fit
)contour
plt =
TRUE
.
For multi-session input (traps
) the value is a list of such
lists, one per session.pdot.contour
constructs a rectangular mask and applies pdot
to
compute the p.(X) at each mask point.
if convex = FALSE
, buffer.contour
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
, buffer.contour
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.pdot
, make.mask
possumtraps <- traps(possumCH)
plot(possumtraps, border = 270)
pdot.contour(possumtraps, detectfn = 0, nx = 128, detectpar =
detectpar(possum.model.0), levels = c(0.1, 0.01, 0.001),
noccasions = 5, add = TRUE)
## convex and concave buffers
plot(possumtraps, border = 270)
buffer.contour(possumtraps, buffer = 100, add = TRUE, col = "blue")
buffer.contour(possumtraps, buffer = 100, convex = TRUE, add = TRUE)
## areas
buff.concave <- buffer.contour(possumtraps, buffer = 100,
plt = FALSE)
buff.convex <- buffer.contour(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 <- buffer.contour(possumtraps, buffer = 100,
nx = 128, plt = FALSE)
sum (sapply(buff.concave2, polyarea))
## 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)
pdot.contour(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
Run the code above in your browser using DataLab