Learn R Programming

VGAM (version 0.9-1)

posbernUC: Positive Bernoulli Sequence Model

Description

Density, and random generation for multiple Bernoulli responses where each row in the response matrix has at least one success.

Usage

rposbern(n, nTimePts = 5, pvars = length(xcoeff), xcoeff = c(-2, 1, 2),
         cap.effect = -1, link = "logit", is.popn = FALSE, earg.link = FALSE)
dposbern(x, prob, prob0 = prob, log = FALSE)

Arguments

x
response vector or matrix. Should only have 0 and 1 values, at least two columns, and each row should have at least one 1.
nTimePts
Number of sampling occasions. Called $\tau$ in posbernoulli.b and posbernoulli.t.
n
number of observations. Usually a single positive integer, else the length of the vector is used. See argument is.popn.
is.popn
Logical. If TRUE then argument n is the population size and what is returned may have substantially less rows than n. That is, if an animal has at least one one in its sequence then it is returned, else tha
cap.effect
Numeric, the capture effect. Added to the linear predictor if captured previously. A positive or negative value corresponds to a trap-happy and trap-shy effect respectively.
pvars
Number of other numeric covariates that make up the linear predictor. Labelled x1, x2, ..., where the first is an intercept, and the others are independent standard runif<
xcoeff
The regression coefficients of the linear predictor. These correspond to x1, x2, ..., and the first is for the intercept. The length of xcoeff must be at least pvars.
link, earg.link
The former is used to generate the probabilities for capture at each occasion. Other details at CommonVGAMffArguments.
prob, prob0
Matrix of probabilities for the numerator and denominators respectively. The default does not correspond to the $M_b$ model since the $M_b$ model has a denominator which involves the capture history.
log
Logical. Return the logarithm of the answer?

Value

  • This function returns a data frame with some attributes. The function generates random deviates ($\tau$ columns labelled y1, y2, ...) for the response. Some indicator columns are also included (those starting with ch are for previous capture history, and those starting with z are zero), and these are useful for the xij argument.

    The function dposbern gives the density,

Details

The form of the conditional likelihood is described in posbernoulli.b.

The denominator is equally shared among the elements of the matrix x.

See Also

posbernoulli.b, posbernoulli.t, posbernoulli.tb.

Examples

Run this code
set.seed(123); rposbern(n = 10)
attributes(rposbern(n = 10))

Run the code above in your browser using DataLab