Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

auxposbernoulli.t

Auxiliary Function for the Positive Bernoulli Family Function with Time Effects


Description

Returns behavioural effects indicator variables from a capture history matrix.

Usage

aux.posbernoulli.t(y, check.y = FALSE, rename = TRUE, name = "bei")

Arguments

y

Capture history matrix. Rows are animals, columns are sampling occasions, and values should be 0s and 1s only.

check.y

Logical, if TRUE then some basic checking is performed.

rename, name

If rename = TRUE then the behavioural effects indicator are named using the value of name as the prefix. If FALSE then use the same column names as y.

Details

This function can help fit certain capture–recapture models (commonly known as M_{tb} or M_{tbh} (no prefix h means it is an intercept-only model) in the literature). See posbernoulli.t for details.

Value

A list with the following components.

cap.hist1

A matrix the same dimension as y. In any particular row there are 0s up to the first capture. Then there are 1s thereafter.

cap1

A vector specifying which time occasion the animal was first captured.

y0i

Number of noncaptures before the first capture.

yr0i

Number of noncaptures after the first capture.

yr1i

Number of recaptures after the first capture.

See Also

Examples

# Fit a M_tbh model to the deermice data:
(pdata <- aux.posbernoulli.t(with(deermice, cbind(y1, y2, y3, y4, y5, y6))))

deermice <- data.frame(deermice,
                    bei = 0,  # Add this
                    pdata$cap.hist1)  # Incorporate these
head(deermice)  # Augmented with behavioural effect indicator variables
tail(deermice)

VGAM

Vector Generalized Linear and Additive Models

v1.1-5
GPL-3
Authors
Thomas Yee [aut, cre], Cleve Moler [ctb] (author of several LINPACK routines)
Initial release
2021-01-13

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.