BBRecap: Bayesian inference for capturerecapture analysis with emphasis on behavioural effect modelling
Description
Bayesian inference for a large class of discretetime capturerecapture models under closed population with special emphasis on behavioural effect modelling including also the meaningful behavioral covariate approach proposed in Alunni Fegatelli (2013) [PhD thesis]. Many of the standard classical models such as M_0, M_b, M_{c_1}, M_t or M_{bt} can be regarded as particular instances of the aforementioned approach. Other flexible alternatives can be fitted through a careful choice of a meaningful behavioural covariate and a possible partition of its admissible range
Usage
 BBRecap (data,last.column.count=FALSE, neval = 1000, by.incr = 1,
mbc.function = c("standard","markov","counts","integer","counts.integer"),
mod = c("linear.logistic", "M0", "Mb", "Mc", "Mcb", "Mt", "Msubjective.cut",
"Msubjective"), nsim = 5000, burnin = round(nsim/10),
nsim.ML = 1000, burnin.ML = round(nsim.ML/10), num.t = 50,
markov.ord=NULL, prior.N = c("Rissanen","Uniform","one.over.N","one.over.N2"),
meaningful.mat.subjective = NULL, meaningful.mat.new.value.subjective = NULL,
z.cut=NULL, output = c("base", "complete", "complete.ML"))

Arguments
data 
can be one of the following:
an M by t binary matrix/data.frame. In this case the input is interpreted as a matrix whose rows contain individual capture histories for all M observed units
a matrix/data.frame with (t+1) columns. The first t columns contain binary entries corresponding to capture occurrences, while the last column contains non negative integers corresponding to frequencies. This format is allowed only when last.column.count is set to TRUE
a tdimensional array or table representing the counts of the 2^t contingency table of binary outcomes
M is the number of units captured at least once and t is the number of capture occasions.

last.column.count 
a logical. In the default case last.column.count=FALSE each row of the input argument data represents the complete capture history for each observed unit. When last.column.count is set to TRUE in each row the first t entries represent one of the observed complete capture histories and the last entry in the last column is the number of observed units with that capture history

neval 
a positive integer. neval is the number of values of the population size N where the posterior is evaluated starting from M. The default value is neval =1000.

by.incr 
a positive integer. by.incr represents the increment on the sequence of possible population sizes N where the posterior is evaluated. The default value is by.incr =1. The use of by.incr >1 is discouraged unless the range of N values of interest is very large

mbc.function 
a character string with possible entries (see Alunni Fegatelli (2013) for further details)

"standard" meaningful behavioural covariate in [0,1] obtained through the normalized binary representation of integers relying upon partial capture history

"markov" slight modification of "standard" providing consistency with arbitrary Markov order models when used in conjunction with the options "Msubjective"
and z.cut .

"counts" covariate in [0,1] obtained by normalizing the integer corresponding to the sum of binary entries i.e. the number of previous captures

"integer" unnormalized integer corresponding to the binary entries of the partial capture history

"counts.integer" unnormalized covariate obtained as the sum of binary entries i.e. the number of previous captures

mod 
a character. mod represents the behavioural model considered for the analysis. mod="linear.logistic" is the model proposed in Alunni Fegatelli (2013) based on the meaningful behavioural covariate. mod="M0" is the most basic model where no effect is considered and all capture probabilities are the same. mod="Mb" is the classical behavioural model where the capture probability
varies only once when first capture occurs. Hence it represents
an enduring effect to capture. mod="Mc" is the ephemeral behavioural Markovian model originally introduced in Yang and Chao (2005) and subsequently extended in Farcomeni (2011) and reviewed in Alunni Fegatelli and Tardella (2012) where capture probability depends only on the capture status (captured or uncaptured) in the previous k=markov.ord occasions. mod="Mcb" is an extension of Yang and Chao's model (2005); it considers both ephemeral and enduring effect to capture. mod="Mt" is the standard temporal effect with no behavioural effect. mod="Msubjective.cut" is an alternative behavioural model obtained through a specific cut on the meaningful behavioural covariate interpreted as memory effect. mod="Msubjective" is a customizable (subjective) behavioural model within the linear logistic model framework requiring the specification of the two additional arguments: the first one is meaningful.mat.subjective and contains an M by t matrix of adhoc meaningful covariates depending on previous capture history; the second one is meaningful.mat.new.value.subjective and contains a vector of length t corresponding to meaningful covariates for a generic uncaptured unit. The default value for mod is "linear.logistic".

nsim 
a positive integer. nsim is the number of iterations for the MetropoliswithinGibbs algorithm which allows the approximation of the posterior. It is considered only if
mod is "linear.logistic" or "Msubjective" . In the other cases closed form evaluation of the posterior is available up to a proportionality constant. The default value is nsim=10000.

burnin 
a positive integer. burnin is the initial number of MCMC samples discarded. It is considered only if mod is "linear.logistic" or "Msubjective" . The default value for burnin is round(nsim/10).

nsim.ML 
a positive integer. nsim.ML is the number of iterations used in the marginal likelihood estimation procedure via power posterior method of Friel and Pettit (2008). This approach is implemented only when mod="linear.logistic" or mod="Msubjective" and when output is set to "complete.ML" . The default value is nsim.ML=500.

burnin.ML 
a positive integer. burnin.ML is the initial number of samples discarded for marginal likelihood estimation via powerposterior approach. It is considered only if mod is "linear.logistic" or "Msubjective" and when output is set to "complete.ML" . The default value is burnin.ML is round(nsim/10) .

num.t 
a positive integer. num.t is the number of powers used in the power posterior approximation method for the marginal likelihood evaluation. It is used only when output="complete.ML" .

markov.ord 
a positive integer. markov.ord is the order of Markovian model M_c or M_{cb}. It is considered only if mod="Mc" or mod="Mcb" .

prior.N 
a character. prior.N is the label for the prior distribution for N. When prior.N is set to "Rissanen" (default) the Rissanen prior is used as a prior on N. This distribution was first proposed in Rissanen 1983 as a universal prior on integers. prior.N="Uniform" stands for a prior on N proportional to a constant value. prior.N="one.over.N" stands for a prior on N proportional to 1/N. prior.N="one.over.N2" stands for a prior on N proportional to 1/N^2.

meaningful.mat.subjective 
M x t matrix containing numerical covariates to be used for a customized logistic model approach

meaningful.mat.new.value.subjective 
1 x t numerical vector corresponding to auxiliary covariate to be considered for unobserved unit

z.cut 
numeric vector. z.cut is a vector containing the cut point for the memory effect covariate. It is considered only if mod="Msubjective.cut"

output 
a character. output selects the kind of output from a very basic
summary info on the posterior output (point and interval estimates for the unknown N) to more complete details including MCMC simulations for all parameters in the model when appropriate

Details
Independent uniform distributions are considered as default prior for the nuisance parameters. If model="linear.logistic"
or model="Msubjective"
and output="complete.ML"
the marginal likelihood estimation is performed through the power posteriors method suggested in Friel and Pettit (2008). In that case the BBRecap
procedure is computing intensive for high values of neval
and nsim
.
Value
Model 
model considered

Prior 
prior distribution for N

N.hat.mean 
posterior mean for N

N.hat.median 
posterior median for N

N.hat.mode 
posterior mode for N

N.hat.RMSE 
minimizer of a specific loss function connected with the Relative Mean Square Error

HPD.N 
95 \% highest posterior density interval estimate for N

log.marginal.likelihood 
log marginal likelihood

N.range 
values of N considered

posterior.N 
values of the posterior distribution for each N considered

z.matrix 
meaningful behavioural covariate matrix for the observed data

vec.cut 
cut point used to set up meaningful partitions the set of the partial capture histories according to the value of the value of the meaningful behavioural covariate

N.vec 
simulated values from the posterior marginal distribution of N

mean.a0 
posterior mean of the parameter a0

mean.a0 
highest posterior density interval estimate of the parameter a0

a0.vec 
simulated values from the posterior marginal distribution of a0

mean.a1 
posterior mean of the parameter a1

mean.a1 
highest posterior density interval estimate of the parameter a1

a1.vec 
simulated values from the posterior marginal distribution of a1

Author(s)
Danilo Alunni Fegatelli and Luca Tardella
References
Friel, N. and Pettitt, A. N. (2008) Marginal likelihood estimation via power posteriors. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 70(3):589–607
Farcomeni A. (2011) Recapture models under equality constraints for the conditional capture probabilities. Biometrika 98(1):237–242
Alunni Fegatelli, D. and Tardella, L. (2012) Improved inference on capture recapture models with behavioural effects. Statistical Methods & Applications Applications Volume 22, Issue 1, pp 4566 10.1007/s1026001202214
See Also
BBRecap.custom.part
,
LBRecap
Examples