multimarkClosed: Fit closed population abundance models for...

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

View source: R/Closed.R

Description

This function fits closed population abundance models for capture-mark-recapture data consisting of multiple non-invasive marks 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
multimarkClosed(Enc.Mat, data.type = "never", covs = data.frame(),
  mms = NULL, mod.p = ~1, mod.delta = ~type, parms = c("pbeta",
  "delta", "N"), nchains = 1, iter = 12000, adapt = 1000, bin = 50,
  thin = 1, burnin = 2000, taccept = 0.44, tuneadjust = 0.95,
  proppbeta = 0.1, propzp = 1, propsigmap = 1, npoints = 500,
  maxnumbasis = 1, a0delta = 1, a0alpha = 1, b0alpha = 1, a = 25,
  mu0 = 0, sigma2_mu0 = 1.75, a0psi = 1, b0psi = 1,
  initial.values = NULL, known = integer(), printlog = FALSE, ...)

Arguments

Enc.Mat

A matrix of observed encounter histories with rows corresponding to individuals and columns corresponding to sampling occasions (ignored unless mms=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 temporal covariates for detection probabilities (ignored unless mms=NULL). The number of rows in the data frame must equal the number of sampling occasions. Covariate names cannot be "time", "c", or "h"; these names are reserved for temporal, behavioral, and individual effects when specifying mod.p and mod.phi.

mms

An optional object of class multimarksetup-class; if NULL it is created. See processdata.

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~h specifies individual heterogeneity, and mod.p~time+c specifies additive temporal and behavioral effects.

mod.delta

Model formula for conditional probabilities of type 1 (delta_1) and type 2 (delta_2) encounters, given detection. Currently only mod.delta=~1 (i.e., δ_1 = δ_2) and mod.delta=~type (i.e., δ_1 \ne δ_2) are implemented.

parms

A character vector giving the names of the parameters and latent variables to monitor. Possible parameters are logit-scale detection probability parameters ("pbeta"), population abundance ("N"), conditional probability of type 1 or type 2 encounter, given detection ("delta)", probability of simultaneous type 1 and type 2 detection, given both types encountered ("alpha"), logit-scale individual heterogeneity variance term ("sigma2_zp"), logit-scale individual effects ("zp"), 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 encounter history indices ("H") 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, propzp, or propsigmap) 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.

propzp

Scaler or vector (of length M) specifying the initial standard deviation of the Normal(zp[i], propzp[i]) proposal distribution. If propzp is a scaler, then this value is used for all i = 1, ..., M individuals. Default is propzp = 1.

propsigmap

Scaler specifying the initial Gamma(shape = 1/propsigmap, scale = sigma_zp * propsigmap) proposal distribution for sigma_zp = sqrt(sigma2_zp). Default is propsigmap=1.

npoints

Number of Gauss-Hermite quadrature points to use for numerical integration. Accuracy increases with number of points, but so does computation time.

maxnumbasis

Maximum number of basis vectors to use when proposing latent history frequency updates. Default is maxnumbasis = 1, but higher values can potentially improve mixing.

a0delta

Scaler or vector (of length d) specifying the prior for the conditional (on detection) probability of type 1 (delta_1), type 2 (delta_2), and both type 1 and type 2 encounters (1-delta_1-delta_2). If a0delta is a scaler, then this value is used for all a0delta[j] for j = 1, ..., d. For mod.delta=~type, d=3 with [delta_1, delta_2, 1-delta_1-delta_2] ~ Dirichlet(a0delta) prior. For mod.delta=~1, d=2 with [tau] ~ Beta(a0delta[1],a0delta[2]) prior, where (delta_1,delta_2,1-delta_1-delta_2) = (tau/2,tau/2,1-tau). See McClintock et al. (2013) for more details.

a0alpha

Specifies "shape1" parameter for [alpha] ~ Beta(a0alpha, b0alpha) prior. Only applicable when data.type = "sometimes". Default is a0alpha = 1. Note that when a0alpha = 1 and b0alpha = 1, then [alpha] ~ Unif(0,1).

b0alpha

Specifies "shape2" parameter for [alpha] ~ Beta(a0alpha, b0alpha) prior. Only applicable when data.type = "sometimes". Default is b0alpha = 1. Note that when a0alpha = 1 and b0alpha = 1, then [alpha] ~ Unif(0,1).

a

Scale parameter for [sigma_z] ~ half-Cauchy(a) prior for the individual hetegeneity term sigma_zp = sqrt(sigma2_zp). Default is “uninformative” a = 25.

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.

a0psi

Specifies "shape1" parameter for [psi] ~ Beta(a0psi,b0psi) prior. Default is a0psi = 1.

b0psi

Specifies "shape2" parameter for [psi] ~ Beta(a0psi,b0psi) prior. Default is b0psi = 1.

initial.values

Optional list of nchain list(s) specifying initial values for parameters and latent variables. Default is initial.values = NULL, which causes initial values to be generated automatically. In addition to the parameters ("pbeta", "N", "delta_1", "delta_2", "alpha", "sigma2_zp", "zp", and "psi"), initial values can be specified for the initial latent history frequencies ("x") and initial individual encounter history indices ("H").

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.

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 multimarkClosed (or multimarkCJS) 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 multimarkClosed. Note that setting parms="all" is required for any multimarkClosed 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

Model formula for conditional probability of type 1 or type 2 encounter, given detection (as specified by mod.delta 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", "delta_1", "delta_2", "alpha", "sigma2_zp", "zp", "psi", "x", and "H".

mms

An object of class multimarksetup

Author(s)

Brett T. McClintock

References

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

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.

McClintock, B. T., Bailey, L. L., Dreher, B. P., and Link, W. A. 2014. Probit models for capture-recapture data subject to imperfect detection, individual heterogeneity and misidentification. The Annals of Applied Statistics 8: 2461-2484.

See Also

bobcat, processdata, multimodelClosed

Examples

1
2
3
4
5
6
7
8
9
# 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 bobcat data
bobcat.dot<-multimarkClosed(bobcat)

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

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