plot.secr | R Documentation |
Plot detection functions using estimates of parameters in an secr object, or as provided by the user.
## S3 method for class 'secr'
plot(x, newdata = NULL, add = FALSE,
sigmatick = FALSE, rgr = FALSE, limits = FALSE, alpha = 0.05,
xval = 0:200, ylim = NULL, xlab = NULL, ylab = NULL, ...)
## S3 method for class 'secrlist'
plot(x, newdata = NULL, add = FALSE,
sigmatick = FALSE, rgr = FALSE, limits = FALSE, alpha = 0.05,
xval = 0:200, ylim = NULL, xlab = NULL, ylab = NULL, ...,
overlay = TRUE)
detectfnplot (detectfn, pars, details = NULL, add = FALSE,
sigmatick = FALSE, rgr = FALSE, hazard = FALSE, xval = 0:200, ylim = NULL,
xlab = NULL, ylab = NULL, ...)
attenuationplot (pars, add = FALSE, spherical = TRUE,
xval = 0:200, ylim = NULL, xlab = NULL, ylab = NULL, ...)
x |
an |
newdata |
dataframe of data to form estimates |
add |
logical to add curve(s) to an existing plot |
sigmatick |
logical; if TRUE the scale parameter sigma is shown by a vertical line |
rgr |
logical; if TRUE a scaled curve r.g(r) is plotted instead of g(r) |
hazard |
logical; if TRUE the hazard of detection is plotted instead of probability |
limits |
logical; if TRUE pointwise confidence limits are drawn |
alpha |
alpha level for confidence intervals |
xval |
vector of distances at for which detection to be plotted |
ylim |
vector length 2 giving limits of y axis |
xlab |
label for x axis |
ylab |
label for y axis |
... |
arguments to pass to |
overlay |
logical; if TRUE then automatically |
detectfn |
integer code or character string for shape of detection function 0 = halfnormal etc. – see detectfn |
pars |
list, vector or matrix of parameter values |
details |
list of ancillary parameters |
spherical |
logical for whether to include spherical spreading term |
newdata
is usually NULL, in which case one curve is plotted for
each session and group. Otherwise, predict.secr
is used to form
estimates and plot a curve for each row in newdata
.
If axis labels are not provided they default to ‘Distance (m)’ and ‘Detection probability’ or ‘Detection lambda’.
detectfnplot
is an alternative in which the user nominates the
type of function and provides parameter values. pars
maybe a list
as from detectpar
; it is first coerced to a numeric vector
with unlist
. Parameter values must be in the expected order
(e.g. g0, sigma, z). If pars
is a matrix then a separate
curve is plotted with the parameter values in each row.
For detectfnplot
the signal threshold parameters ‘cutval’ and
‘spherical’ should be provided in details
(see examples).
Approximate confidence limits for g(r) are calculated using a numerical
first-order delta-method approximation to the standard error at each
xval
. The distribution of g(r) is assumed to be normal on the logit scale for non-hazard functions (detectfn 0:13). For hazard detection functions (detectfn 14:18) the hazard is assumed (from version 3.1.1) to be distributed normally on the log scale. Limits are back-transformed to the probability scale g(r).
attenuationplot
plots the expected decline in signal strength
with distance, given parameters \beta_0
and
\beta_1
for a log-linear model of sound attenuation.
plot.secr
invisibly returns a dataframe of the plotted values (or
a list of dataframes in the case that newdata
has more than one
row).
Detection functions
, plot
, secr
plot (secrdemo.b, xval = 0:100, ylim = c(0, 0.4))
## Add recapture probability
plot (secrdemo.b, newdata = data.frame(b = 1), add = TRUE,
col = "red")
## signal strength detection: 70dB at source, attenuation
## 0.3dB/m, sdS 5dB; detection threshold 40 dB.
detectfnplot (detectfn = 10, c(70, -0.3, 5), details =
list(cutval = 40))
## add a function with louder source and spherical spreading...
detectfnplot (detectfn = 11, c(110, -0.3, 5), details =
list(cutval = 40), add = TRUE, col = "red")
## matching sound attenuation curves; `spherical-only' dashed line
attenuationplot (c(70, -0.3), spherical = FALSE, ylim=c(-10,110))
attenuationplot (c(110, 0), spherical = TRUE, add=TRUE, lty=2)
attenuationplot (c(110, -0.3), spherical = TRUE, add = TRUE,
col = "red")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.