processdataSCR: Generate model inputs for fitting spatial 'multimark' models

View source: R/multimark_functions.R

processdataSCRR Documentation

Generate model inputs for fitting spatial 'multimark' models

Description

This function generates an object of class multimarkSCRsetup that is required to fit spatial ‘multimark’ models.

Usage

processdataSCR(
  Enc.Mat,
  trapCoords,
  studyArea = NULL,
  buffer = NULL,
  ncells = NULL,
  data.type = "never",
  covs = data.frame(),
  known = integer(),
  scalemax = 10
)

Arguments

Enc.Mat

A matrix containing the observed encounter histories with rows corresponding to individuals and (ntraps*noccas) columns corresponding to traps and sampling occasions. The first noccas columns correspond to trap 1, the second noccas columns corresopond to trap 2, etc. Ignored unless mms=NULL.

trapCoords

A matrix of dimension ntraps x (2 + noccas) indicating the Cartesian coordinates and operating occasions for the traps, where rows correspond to trap, the first column the x-coordinate, and the second column the y-coordinate. The last noccas columns indicate whether or not the trap was operating on each of the occasions, where ‘1’ indciates the trap was operating and ‘0’ indicates the trap was not operating.

studyArea

is a 3-column matrix containing the coordinates for the centroids of a contiguous grid of cells that define the study area and available habitat. Each row corresponds to a grid cell. The first 2 columns indicate the Cartesian x- and y-coordinate for the centroid of each grid cell, and the third column indicates whether the cell is available habitat (=1) or not (=0). All cells must be square and have the same resolution. If studyArea=NULL (the default), then a square study area grid composed of ncells cells of available habitat is drawn around the bounding box of trapCoords based on buffer. Note that rows should be ordered in raster cell order (raster cell numbers start at 1 in the upper left corner, and increase from left to right, and then from top to bottom).

buffer

A scaler in same units as trapCoords indicating the buffer around the bounding box of trapCoords for defining the study area when studyArea=NULL. Ignored unless studyArea=NULL.

ncells

The number of grid cells in the study area when studyArea=NULL. The square root of ncells must be a whole number. Default is ncells=1024. Ignored unless studyArea=NULL.

data.type

Specifies the encounter history data type. All data types include non-detections (type 0 encounter), type 1 encounter (e.g., left-side), and type 2 encounters (e.g., right-side). When both type 1 and type 2 encounters occur for the same individual within a sampling occasion, these can either be "non-simultaneous" (type 3 encounter) or "simultaneous" (type 4 encounter). Three data types are currently permitted:

data.type="never" indicates both type 1 and type 2 encounters are never observed for the same individual within a sampling occasion, and observed encounter histories therefore include only type 1 or type 2 encounters (e.g., only left- and right-sided photographs were collected). Observed encounter histories can consist of non-detections (0), type 1 encounters (1), and type 2 encounters (2). See bobcat. Latent encounter histories consist of non-detections (0), type 1 encounters (1), type 2 encounters (2), and type 3 encounters (3).

data.type="sometimes" indicates both type 1 and type 2 encounters are sometimes observed (e.g., both-sided photographs are sometimes obtained, but not necessarily for all individuals). Observed encounter histories can consist of non-detections (0), type 1 encounters (1), type 2 encounters (2), type 3 encounters (3), and type 4 encounters (4). Type 3 encounters can only be observed when an individual has at least one type 4 encounter. Latent encounter histories consist of non-detections (0), type 1 encounters (1), type 2 encounters (2), type 3 encounters (3), and type 4 encounters (4).

data.type="always" indicates both type 1 and type 2 encounters are always observed, but some encounter histories may still include only type 1 or type 2 encounters. Observed encounter histories can consist of non-detections (0), type 1 encounters (1), type 2 encounters (2), and type 4 encounters (4). Latent encounter histories consist of non-detections (0), type 1 encounters (1), type 2 encounters (2), and type 4 encounters (4).

covs

A data frame of time- and/or trap-dependent covariates for detection probabilities (ignored unless mms=NULL). The number of rows in the data frame must equal the number of traps times the number of sampling occasions (ntraps*noccas), where the first noccas rows correspond to trap 1, the second noccas rows correspond to trap 2, etc. Covariate names cannot be "time", "age", or "h"; these names are reserved for temporal, behavioral, and individual effects when specifying mod.p and mod.phi.

known

Optional integer vector indicating whether the encounter history of an individual is known with certainty (i.e., the observed encounter history is the true encounter history). Encounter histories with at least one type 4 encounter are automatically assumed to be known, and known does not need to be specified unless there exist encounter histories that do not contain a type 4 encounter that happen to be known with certainty (e.g., from independent telemetry studies). If specified, known = c(v_1,v_2,...,v_M) must be a vector of length M = nrow(Enc.Mat) where v_i = 1 if the encounter history for individual i is known (v_i = 0 otherwise). Note that known all-zero encounter histories (e.g., ‘000’) are ignored.

scalemax

Upper bound for internal re-scaling of grid cell centroid coordinates. Default is scalemax=10, which re-scales the centroids to be between 0 and 10. Re-scaling is done internally to avoid numerical overflows during model fitting.

Value

An object of class multimarkSCRsetup.

Author(s)

Brett T. McClintock

References

Bonner, S. J., and Holmberg J. 2013. Mark-recapture with multiple, non-invasive marks. Biometrics 69: 766-775.

Gopalaswamy, A.M., Royle, J.A., Hines, J.E., Singh, P., Jathanna, D., Kumar, N. and Karanth, K.U. 2012. Program SPACECAP: software for estimating animal density using spatially explicit capture-recapture models. Methods in Ecology and Evolution 3:1067-1072.

McClintock, B. T., Conn, P. B., Alonso, R. S., and Crooks, K. R. 2013. Integrated modeling of bilateral photo-identification data in mark-recapture analyses. Ecology 94: 1464-1471.

Royle, J.A., Karanth, K.U., Gopalaswamy, A.M. and Kumar, N.S. 2009. Bayesian inference in camera trapping studies for a class of spatial capture-recapture models. Ecology 90: 3233-3244.

See Also

multimarkSCRsetup-class, multimarkClosedSCR

Examples



# This example is excluded from testing to reduce package check time
# Example uses unrealistically low values for nchain, iter, and burnin

#Generate object of class "multimarksetup" from simulated data
sim.data<-simdataClosedSCR()
Enc.Mat <- sim.data$Enc.Mat
trapCoords <- sim.data$spatialInputs$trapCoords
studyArea <- sim.data$spatialInputs$studyArea
setup <- processdataSCR(Enc.Mat,trapCoords,studyArea)

#Run single chain using the default model for simulated data
example.dot<-multimarkClosedSCR(mms=setup)


multimark documentation built on March 31, 2023, 9:33 p.m.