markClosedSCR: Fit spatial population abundance models for "traditional"...

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/ClosedSCR.R

Description

This function fits spatial population abundance models for “traditional” capture-mark-recapture data consisting of a single mark type using Bayesian analysis methods. Markov chain Monte Carlo (MCMC) is used to draw samples from the joint posterior distribution.

Usage

1
2
3
4
5
6
7
8
markClosedSCR(Enc.Mat, trapCoords, studyArea = NULL, buffer = NULL,
  ncells = 1024, covs = data.frame(), mod.p = ~1,
  detection = "half-normal", parms = c("pbeta", "N"), nchains = 1,
  iter = 12000, adapt = 1000, bin = 50, thin = 1, burnin = 2000,
  taccept = 0.44, tuneadjust = 0.95, proppbeta = 0.1,
  propsigma = 1, propcenter = NULL, sigma_bounds = NULL, mu0 = 0,
  sigma2_mu0 = 1.75, initial.values = NULL, scalemax = 10,
  printlog = FALSE, ...)

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.

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 (“x”), and the second column the y-coordinate (“y”). 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. Ignored unless mms=NULL.

studyArea

is a 3-column matrix containing the coordinates for the centroids a contiguous grid of cells that define the study area and available habitat. Each row corresponds to a grid cell. The first 2 columns (“x” and “y”) indicate the Cartesian x- and y-coordinate for the centroid of each grid cell, and the third column (“avail”) indicates whether the cell is available habitat (=1) or not (=0). All cells must have the same resolution. If studyArea=NULL (the default) and mms=NULL, then a square study area grid composed of ncells cells of available habitat is drawn around the bounding box of trapCoords based on buffer. Ignored unless mms=NULL.

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 and mms=NULL.

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 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.

mod.p

Model formula for detection probability. For example, mod.p=~1 specifies no effects (i.e., intercept only), mod.p~time specifies temporal effects, mod.p~c specifies behavioral reponse (i.e., trap "happy" or "shy"), mod.p~trap specifies trap effects, and mod.p~time+c specifies additive temporal and behavioral effects.

detection

Model for detection probability as a function of distance from activity centers . Must be "half-normal" (of the form \exp{(-d^2 / (2*σ^2))}, where d is distance) or "exponential" (of the form \exp{(-d / λ)}).

parms

A character vector giving the names of the parameters and latent variables to monitor. Possible parameters are cloglog-scale detection probability parameters ("pbeta"), population abundance ("N"), cloglog-scale distance term for the detection function ("sigma2_scr" when detection=``half-normal'' or "lambda" when detection=``exponential''), and the probability that a randomly selected individual from the M = nrow(Enc.Mat) observed individuals belongs to the n unique individuals encountered at least once ("psi"). Individual activity centers ("centers"), and the log posterior density ("logPosterior") may also be monitored. Setting parms="all" monitors all possible parameters and latent variables.

nchains

The number of parallel MCMC chains for the model.

iter

The number of MCMC iterations.

adapt

The number of iterations for proposal distribution adaptation. If adapt = 0 then no adaptation occurs.

bin

Bin length for calculating acceptance rates during adaptive phase (0 < bin <= iter).

thin

Thinning interval for monitored parameters.

burnin

Number of burn-in iterations (0 <= burnin < iter).

taccept

Target acceptance rate during adaptive phase (0 < taccept <= 1). Acceptance rate is monitored every bin iterations. Default is taccept = 0.44.

tuneadjust

Adjustment term during adaptive phase (0 < tuneadjust <= 1). If acceptance rate is less than taccept, then proposal term (proppbeta or propsigma) is multiplied by tuneadjust. If acceptance rate is greater than or equal to taccept, then proposal term is divided by tuneadjust. Default is tuneadjust = 0.95.

proppbeta

Scaler or vector (of length k) specifying the initial standard deviation of the Normal(pbeta[j], proppbeta[j]) proposal distribution. If proppbeta is a scaler, then this value is used for all j = 1, ..., k. Default is proppbeta = 0.1.

propsigma

Scaler specifying the initial Gamma(shape = 1/propsigma, scale = sigma_scr * propsigma) proposal distribution for sigma_scr = sqrt(sigma2_scr). Default is propsigma=1.

propcenter

Scaler specifying the neighborhood distance when proposing updates to activity centers. When propcenter=NULL (the default), then propcenter = a*10, where a is the cell size for the study area grid, and each cell has (at most) approximately 300 neighbors.

sigma_bounds

Positive vector of length 2 for the lower and upper bounds for the [sigma_scr] ~ Uniform(sigma_bounds[1], sigma_bounds[2]) (or [sqrt(lambda)] when detection=``exponential'') prior for the detection function term sigma_scr = sqrt(sigma2_scr) (or sqrt(lambda)). When sigma_bounds = NULL (the default), then sigma_bounds = c(1.e-6,max(diff(range(studyArea[,"x"])),diff(range(studyArea[,"y"])))).

mu0

Scaler or vector (of length k) specifying mean of pbeta[j] ~ Normal(mu0[j], sigma2_mu0[j]) prior. If mu0 is a scaler, then this value is used for all j = 1, ..., k. Default is mu0 = 0.

sigma2_mu0

Scaler or vector (of length k) specifying variance of pbeta[j] ~ Normal(mu0[j], sigma2_mu0[j]) prior. If sigma2_mu0 is a scaler, then this value is used for all j = 1, ..., k. Default is sigma2_mu0 = 1.75.

initial.values

Optional list of nchain list(s) specifying initial values for "pbeta", "N", "sigma2_scr", and "centers". Default is initial.values = NULL, which causes initial values to be generated automatically.

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.

printlog

Logical indicating whether to print the progress of chains and any errors to a log file in the working directory. Ignored when nchains=1. Updates are printed to log file as 1% increments of iter of each chain are completed. With >1 chains, setting printlog=TRUE is probably most useful for Windows users because progress and errors are automatically printed to the R console for "Unix-like" machines (i.e., Mac and Linux) when printlog=FALSE. Default is printlog=FALSE.

...

Additional "parameters" arguments for specifying mod.p. See make.design.data.

Details

The first time markClosedSCR is called, it will likely produce a firewall warning alerting users that R has requested the ability to accept incoming network connections. Incoming network connections are required to use parallel processing as implemented in markClosed. Note that setting parms="all" is required for any markClosed model output to be used in multimodelClosed.

Value

A list containing the following:

mcmc

Markov chain Monte Carlo object of class mcmc.list.

mod.p

Model formula for detection probability (as specified by mod.p above).

mod.delta

Formula always NULL; only for internal use in multimodelClosedSCR.

mod.det

Model formula for detection function (as specified by detection above).

DM

A list of design matrices for detection probability generated for model mod.p, where DM$p is the design matrix for initial capture probability (p) and DM$c is the design matrix for recapture probability (c).

initial.values

A list containing the parameter and latent variable values at iteration iter for each chain. Values are provided for "pbeta", "N", "sigma2_scr", and "centers".

mms

An object of class multimarkSCRsetup

Author(s)

Brett T. McClintock

References

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.

King, R., McClintock, B. T., Kidney, D., and Borchers, D. L. 2016. Capture-recapture abundance estimation using a semi-complete data likelihood approach. The Annals of Applied Statistics 10: 264-285

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

multimodelClosedSCR

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# This example is excluded from testing to reduce package check time
# Example uses unrealistically low values for nchain, iter, and burnin

#Run single chain using the default model for ``traditional'' tiger data of Royle et al (2009)
Enc.Mat<-tiger$Enc.Mat
trapCoords<-tiger$trapCoords
studyArea<-tiger$studyArea
tiger.dot<-markClosedSCR(Enc.Mat,trapCoords,studyArea,iter=100,adapt=50,burnin=50)

#Posterior summary for monitored parameters
summary(tiger.dot$mcmc)
plot(tiger.dot$mcmc)

multimark documentation built on May 1, 2019, 7:05 p.m.