locations: Plotting estimated locations

View source: R/locations.r

locationsR Documentation

Plotting estimated locations

Description

Plots estimated densities of animal locations, which are latent variables in SECR models.

Usage

locations(
  fit,
  id = "all",
  session = 1,
  infotypes = NULL,
  combine = FALSE,
  xlim = NULL,
  ylim = NULL,
  mask = get.mask(fit, session),
  newdata = NULL,
  levels = NULL,
  nlevels = 10,
  density = FALSE,
  cols = list(combined = 1, capt = 2, ss = 3, bearing = 4, dist = 5, toa = 6),
  ltys = list(combined = "solid", capt = "solid", ss = "solid", bearing = "solid", dist
    = "solid", toa = "solid"),
  trap.col = "red",
  circle.traps = TRUE,
  show.labels = TRUE,
  plot.contours = TRUE,
  plot.estlocs = FALSE,
  keep.estlocs = FALSE,
  plot.arrows = "bearing" %in% fit$infotypes,
  plot.circles = "dist" %in% fit$infotypes & !("bearing" %in% fit$infotypes),
  arrow.length = NULL,
  show.legend = FALSE,
  show.axes = TRUE,
  add = FALSE
)

Arguments

fit

A fitted model from fit.ascr.

id

A numeric vector with row numbers from fit$args$capt, indicating which individuals' locations are to be plotted. Alternatively, the character string "all", indicating all animals within the selected session.

session

The session with the detector array and invidual(s) to be plotted (for multi-session models only).

infotypes

A character vector indicating the type(s) of information to be used when plotting the estimated density of location. Elements can be a subset of "capt", "bearing", "dist", "ss", "toa", "combined", and "all", where "capt" shows estimated location only using detection locations, "combined" combines all information types together, and "all" plots all possible contour types. When signal strength information is used in the model fit, "capt" and "ss" are equivalent as the signal strength information is built into the detection function. By default, only the most informative contour is plotted, i.e., "capt" if the model was fitted with no additional information, and "combined" otherwise.

combine

Logical, if TRUE then the information types specified in infotypes are combined into a single contour. If FALSE then separate contours are plotted for each information type.

xlim

A numeric vector of length 2, giving the x coordinate range.

ylim

A numeric vector of length 2, giving the y coordinate range.

mask

A matrix with two columns. Each row provides Cartesian coordinates for the location of a mask point. The function create.mask will return a suitable object. The mask used to fit the model fit will be used by default; this argument is usually used when estimated location contours need to be plotted to a higher resolution than this.

newdata

If a new mask is provided in the mask argument, and the model fits an inhomogeneous density surface via mask-level covariates, then this argument must provide the covariates for the new mask's point locations.

levels

A numeric vector giving the values to be associated with the plotted contours.

nlevels

The number of contour levels desired. Ignored if levels is provided.

density

Logical, if TRUE, the labels on contours (and the levels specified by levels) refer to the density of the estimated distribution of the individual's location. If FALSE, the labels on contours (and the levels specified by levels) refer to the probability of the individual being located within the associated contour under the estimated distribution of the individual's location.

cols

A list with named components corresponding to each contour type (i.e., a subset of "capt", "bearing", "dist", "toa", and "combined"). Each component provides the colour of the associated contour type (e.g., using a character string such as "red", or a call to the function rgb). By default, if only one contour is to be plotted, it will be plotted in black. Alternatively, a vector with a single element, specifying the colour for all contours.

ltys

The line type of the contours, with the same required syntax as cols; see par.

trap.col

The colour of the points representing detector locations.

circle.traps

Logical, if TRUE circles are plotted around traps that made a detection of the individual in question.

show.labels

Logical, if TRUE, contours are labelled with the appropriate probability density (if density is TRUE), or the corresponding probability of the individual being within the associated contour, under the estimated density (if density is FALSE).

plot.contours

Logical, if TRUE, contours are plotted. Note that, if FALSE, nothing corresponding to the density of the individuals' locations is plotted unless plot.estlocs is TRUE.

plot.estlocs

Logical, if TRUE, dots are plotted at the mode of the combined densities. If a density has more than a single mode (and the modes have the same density value) then a dot will only be plotted at one of them.

keep.estlocs

Logical, if TRUE, the locations of the estimated locations are invisibly returned.

plot.arrows

Logical, if TRUE, arrows indicating the estimated bearing to the individual are plotted from detectors at which detections were made.

plot.circles

Logical, if TRUE, circles indicating the estimated distance to the individual are plotted around detectors at which detections were made.

arrow.length

Numeric, providing the length of the arrows (only used if plot.arrows is TRUE).

show.legend

Logical, if TRUE, a legend will be added to the plot.

show.axes

Logical, if TRUE, axes will be added to the plot.

add

Logical, if TRUE, contours will be added to an existing plot.

Value

If keep.estlocs is TRUE, then a list containing a matrix of estimated locations is invisibly returned. See examples.

Examples

locations(example.data$fits$simple.hn, 1)
locations(example.data$fits$simple.hn, 1, levels = c(0.50, 0.90, 0.95))
## Saving estimated locations.
estlocs <- locations(example.data$fits$simple.hn, keep.estlocs = TRUE)
estlocs
## Not run: 
fine.mask <- create.mask(example.data$traps, 20, spacing = 0.2)
locations(example.data$fits$bearing.hn, 1, infotypes = "all", mask = fine.mask)

## End(Not run)


b-steve/ascr documentation built on Aug. 15, 2022, 2:38 p.m.