This function fits Cormack-Jolly-Seber (CJS) open population models for survival probability (\(\phi\)) and capture probability (\(p\)) 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.
markCJS(
Enc.Mat,
covs = data.frame(),
mod.p = ~1,
mod.phi = ~1,
parms = c("pbeta", "phibeta"),
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,
propphibeta = 0.1,
propzphi = 1,
propsigmaphi = 1,
pbeta0 = 0,
pSigma0 = 1,
phibeta0 = 0,
phiSigma0 = 1,
l0p = 1,
d0p = 0.01,
l0phi = 1,
d0phi = 0.01,
initial.values = NULL,
link = "probit",
printlog = FALSE,
...
)
A list containing the following:
Markov chain Monte Carlo object of class mcmc.list
.
Model formula for detection probability (as specified by mod.p
above).
Model formula for survival probability (as specified by mod.phi
above).
Formula always NULL
; only for internal use in multimodelCJS
.
A list of design matrices for detection and survival probability respectively generated by mod.p
and mod.phi
, where DM$p is the design matrix for capture probability (\(p\)) and DM$phi is the design matrix for survival probability (\(\phi\)).
A list containing the parameter and latent variable values at iteration iter
for each chain. Values are provided for "pbeta
", "phibeta
", "sigma2_zp
", "sigma2_zphi
", "zp
", "zphi
", and "q
".
An object of class multimarksetup
A matrix of observed encounter histories with rows corresponding to individuals and columns corresponding to sampling occasions. With a single mark type, encounter histories consist of only non-detections (0) and type 1 encounters (1).
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", "age", or "h"; these names are reserved for temporal, behavioral, and individual effects when specifying mod.p
and mod.phi
.
Model formula for detection probability (\(p\)). For example, mod.p=~1
specifies no effects (i.e., intercept only), mod.p~time
specifies temporal effects, mod.p~age
specifies age effects, mod.p~h
specifies individual heterogeneity, and mod.p~time+age
specifies additive temporal and age effects.
Model formula for survival probability (\(\phi\)). For example, mod.phi=~1
specifies no effects (i.e., intercept only), mod.phi~time
specifies temporal effects, mod.phi~age
specifies age effects, mod.phi~h
specifies individual heterogeneity, and mod.phi~time+age
specifies additive temporal and age effects.
A character vector giving the names of the parameters and latent variables to monitor. Possible parameters are probit-scale detection probability parameters ("pbeta
" for \(p\) and "phibeta
" for \(\phi\)), probit-scale individual heterogeneity variance terms ("sigma2_zp
" for \(p\) and "sigma2_zphi
" for \(\phi\)), and probit-scale individual effects ("zp
" and "zphi
"). Latent variable indicators for whether each individual was alive (1) or dead (0) during each sampling occasion ("q
") and the log likelihood ("loglike
") may also be monitored. Setting parms="all"
monitors all possible parameters and latent variables.
The number of parallel MCMC chains for the model.
The number of MCMC iterations.
Ignored; no adaptive phase is needed for "probit" link.
Ignored; no adaptive phase is needed for "probit" link.
Thinning interval for monitored parameters.
Number of burn-in iterations (0 <= burnin < iter
).
Ignored; no adaptive phase is needed for "probit" link.
Ignored; no adaptive phase is needed for "probit" link.
Ignored; no adaptive phase is needed for "probit" link.
Ignored; no adaptive phase is needed for "probit" link.
Ignored; no adaptive phase is needed for "probit" link.
Ignored; no adaptive phase is needed for "probit" link.
Ignored; no adaptive phase is needed for "probit" link.
Ignored; no adaptive phase is needed for "probit" link.
Scaler or vector (of length k) specifying mean of pbeta ~ multivariateNormal(pbeta0, pSigma0) prior. If pbeta0
is a scaler, then this value is used for all j = 1, ..., k. Default is pbeta0 = 0
.
Scaler or k x k matrix specifying covariance matrix of pbeta ~ multivariateNormal(pbeta0, pSigma0) prior. If pSigma0
is a scaler, then this value is used for all pSigma0[j,j] for j = 1, ..., k (with pSigma[j,l] = 0 for all \(j \ne l\)). Default is pSigma0 = 1
.
Scaler or vector (of length k) specifying mean of phibeta ~ multivariateNormal(phibeta0, phiSigma0) prior. If phibeta0
is a scaler, then this value is used for all j = 1, ..., k. Default is phibeta0 = 0
.
Scaler or k x k matrix specifying covariance matrix of phibeta ~ multivariateNormal(phibeta0, phiSigma0) prior. If phiSigma0
is a scaler, then this value is used for all phiSigma0[j,j] for j = 1, ..., k (with phiSigma[j,l] = 0 for all \(j \ne l\)). Default is phiSigma0 = 1
.
Specifies "shape" parameter for [sigma2_zp] ~ invGamma(l0p,d0p) prior. Default is l0p = 1
.
Specifies "scale" parameter for [sigma2_zp] ~ invGamma(l0p,d0p) prior. Default is d0p = 0.01
.
Specifies "shape" parameter for [sigma2_zphi] ~ invGamma(l0phi,d0phi) prior. Default is l0phi = 1
.
Specifies "scale" parameter for [sigma2_zphi] ~ invGamma(l0phi,d0phi) prior. Default is d0phi = 0.01
.
OOptional list of nchain
list(s) specifying initial values for "pbeta
", "phibeta
", "sigma2_zp
", "sigma2_zphi
", "zp
", "zphi
", and "q
". Default is initial.values = NULL
, which causes initial values to be generated automatically.
Link function for survival and capture probabilities. Only probit link is currently implemented.
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
and mod.phi
. See RMark::make.design.data
.
Brett T. McClintock
The first time markCJS
(or markClosed
) 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 multimarkCJS
. Note that setting parms="all"
is required for any markCJS
model output to be used in multimodelCJS
.
processdata
, multimodelCJS
# \donttest{
# These examples are excluded from testing to reduce package check time
# Example uses unrealistically low values for nchain, iter, and burnin
#Simulate open population data using defaults
data <- simdataCJS(delta_1=1,delta_2=0)$Enc.Mat
#Fit default open population model
sim.dot <- markCJS(data)
#Posterior summary for monitored parameters
summary(sim.dot$mcmc)
plot(sim.dot$mcmc)
#Fit ``age'' model with 2 age classes (e.g., juvenile and adult) for survival
#using 'parameters' and 'right' arguments from RMark::make.design.data
sim.age <- markCJS(data,mod.phi=~age,
parameters=list(Phi=list(age.bins=c(0,1,4))),right=FALSE)
summary(getprobsCJS(sim.age))# }
Run the code above in your browser using DataLab