simCJS: Simulate individual capture-histories under a...

View source: R/simCJS_AHM2_3-2-2.R

simCJSR Documentation

Simulate individual capture-histories under a Cormack-Jolly-Seber (CJS) survival model

Description

Function generates individual capture-histories under a CJS model with possibly time-dependent parameters. The number of values for interval-specific survival (phi) and time-specific detection (p) must be ensured to be equal to the number of occasions (n.occ) minus 1.

Usage

simCJS(n.occ = 6, n.marked = 20, phi = 0.7, p = 0.4, show.plot = TRUE)

Arguments

n.occ

The number of occasions (eg, years).

n.marked

The number of individuals marked per year except for the last year; scalar, or a vector of length (n.occ-1).

phi

The apparent survival probability between years; scalar, or a vector of length (n.occ-1).

p

The recapture probability for all except the first year; scalar, or a vector of length (n.occ-1).

show.plot

Choose whether to show plots or not. Set to FALSE when using function in simulations.

Value

A list with the values of the arguments entered and the following additional elements:

z

n.ind x n.occ matrix, 1 if the individual is alive and in the study area, 0 otherwise.

ch

n.ind x n.occ matrix, 1 if the individual is captured, 0 otherwise.

f

n.ind vector, occasion the individual was first captured, and marked.

n.ind

scalar, total number of individuals marked.

n.alive

n.occ vector, number of animals alive and in the study area each year.

Author(s)

Marc Kéry & Andy Royle, based on code written by Michael Schaub for Chapter 7 of Kéry & Schaub (2012).

References

Kéry, M. & Schaub, M. (2012) Bayesian population analysis using WinBUGS - a hierarchical perspective, Academic Press.

Kéry, M. & Royle, J.A. (2021) Applied Hierarchical Modeling in Ecology AHM2 - 3.2.2.

Examples

# Run with the default arguments and look at the structure of the output:
set.seed(123)
tmp <- simCJS()
str(tmp)
colSums(tmp$ch)

AHMbook documentation built on Sept. 12, 2024, 6:37 a.m.