marrayAge: Creates age-dependent m-arrays

View source: R/marrayAge.R

marrayAgeR Documentation

Creates age-dependent m-arrays

Description

Converts single-state capture-recapture data to age-dependent m-arrays.

Usage

marrayAge(ch, age = 1, mAge = 1, freq = 1, groups = NULL)

Arguments

ch

an individuals x time matrix with capture histories (0: not captured; 1: captured). See Details.

age

vector with the age class at first capture for each individual, or a scalar that will be used for all individuals.

mAge

maximum number of age classes for which m-arrays are constructed; ignored if max(age) > mAge. Only required if the age vector has fewer age classes than we want to separate (e.g. capture histories ch contains only individuals marked as juveniles, and we want 2 age classes).

freq

a vector with the number of animals with each capture history, or a matrix with a column for each group. If a single value is supplied, it will be used for all rows in the capture history; the default is to assume each row corresponds to a single animal.

groups

a factor (or a vector that can be coerced to a factor) which identifies the group that each row of ch refers to. Ignored if freq is a matrix with > 1 column.

Details

The argument ch can be a matrix of unique capture histories accompanied by a vector or matrix, freq, specifying the number of animals with each capture history. Trap losses can be indicated either by negative values for freq, or by filling the row with NA after the last capture. For other formats, see ch2matrix.

Value

A 4-d array, (years-1) x years x age classes x groups, where element [i, j, k, g] contains the number of individuals in group g of age class k released in year i and recaptured in year j+1 (by definition no recaptures can occur in year 1). If no groups are specified, this will be a 3-d array, (years-1) x years x age classes. The last column contains the number of individuals released in year i and never recaptured.

Author(s)

Michael Schaub

References

Schaub, M., Kéry, M. (2022) Integrated Population Models, Academic Press, section 4.5.1.2.

Examples

data(woodchat5)
dim(woodchat5$ch)  # 1902 animals x 20 years
marrayAge(ch=woodchat5$ch, age=woodchat5$age, mAge=2)

IPMbook documentation built on Aug. 22, 2023, 1:07 a.m.