make.scrFrame: Create a formatted oSCR data object

View source: R/make.scrFrame.R

make.scrFrameR Documentation

Create a formatted oSCR data object

Description

A helper function for creating the primary oSCR data object, an scrFrame, used for fitting spatial capture-recapture models with the fitting function oSCR.fit.

Usage

make.scrFrame(caphist, traps, indCovs = NULL, trapCovs = NULL, trapOperation = NULL, telemetry = NULL, rsfDF = NULL, type = "scr")

Arguments

caphist

A list of capture history arrays with dimensions n x J x K (individual-by-trap-by-occasion), one array for each session. The arrays are either binary detection/non-detection data or encounter frequencies (counts).

traps

A list of trap coordinates, one for each session. The coordinate columns must be named ‘X’ and ‘Y’ (note these are capitals). All traps used in the study must be provided here and should coincide with the columns of the caphist array. Traps that are not operational in specific occasions can be ‘turned off’ by supplying the appropriate trapOperation object.

indCovs

A list, one for each session, containing individual-specific data. Currently two types of individual covariates are used:

1) sex, a binary (two-class) covariate codes as 1 for males, 0 for females, and NA for individuals with unknown sex.

2) removed, a integer value detailing on which occasion an individual was removed from the study (e.g., a mortality event). If there were no removals then this information is not required.\

If supplied, the columns of the indCovs must be named sex and/or removed.

trapCovs

A two level list (a list of lists, lol). A list for each session contains a list of data frames, one for each occasion, i.e., trap covariates can be time-varying. The occasion level data has a row for each trap matching the traps object, and a named column for each covariate.

trapOperation

A list of binary matrices with dimension J x K (trap-by-occasion), one for each session. The matrix denotes whether a trap was operational (1) or not (0) in each occasion. Traps with trapOperation equal to zero does not contribute to the likelihood.

telemetry

A list with 2 or 3 objects containing data from collared individuals:

1) fixfreq, a list of matrices with dimension n.tel x nG (collared individual-by-grid cell), one for each session. The values are counts of the number of telemetry/GPS fixes within each grid cell of the rsfDF, as returned by the telemetry.processor() function.

2) indCovs, a list containing individual-specific data, one for each session. This is structured the same as the indCovs object for captured individuals, and currently only accommodates sex.

3) cap.tel [optional], a list of vectors, one for each session. Each vector indicates the row positions of collared individuals in the capture data so that likelihoods can be joined under the dependent specification. If no collared individuals were observed in the capture data set then this object is not necessary (NULL by default).

rsfDF

Similar to the ssDF, a list of data frames for each session containing the coordinates of the state-space pixels (labeled "X" and "Y") and covariate values used for fitting the resource selection function. This can be exactly the same as the ssDF, or represent a grid with an even finer resolution (coarser resolution NOT recommended).

By specifying the rsfDF when making the scrFrame, covariates within the rsfDF are automatically added to trapCovs if missing.

type

This should be set to "SCR".

Details

The scrFrame is the formatted data object required for fitting SCR models using oSCR.fit. A variety of error checks are conducted to ensure that the individual data objects are consistent.

Value

An object of class scrFrame

Author(s)

Chris Sutherland

Examples

data(rbs)
caphist <- rbs.sf$caphist
traps <- rbs.sf$traps
trapCovs <- rbs.sf$trapCovs
sf <- make.scrFrame(caphist = caphist, traps = traps, trapCovs = trapCovs, type = "scr")

jaroyle/oSCR documentation built on Sept. 23, 2023, 12:46 p.m.