Fits a GLM/GAM-like model to multiple Bernoulli responses where each row in the capture history matrix response has at least one success (capture). Sampling occasion effects and behavioural effects are accommodated.
posbernoulli.tb(link = "logit", parallel.t = FALSE ~ 1,
parallel.b = FALSE ~ 0, drop.b = FALSE ~ 1,
type.fitted = c("likelihood.cond", "mean.uncond"),
imethod = 1, iprob = NULL,
p.small = 1e-4, no.warning = FALSE,
ridge.constant = 0.01, ridge.power = -4)
See CommonVGAMffArguments
for information.
A logical, or formula with a logical as the response.
See CommonVGAMffArguments
for information.
The parallel.
-type arguments
specify whether the constraint matrices have a parallelism
assumption for the temporal and behavioural effects.
Argument parallel.t
means parallel with respect to time, and
matches the same argument name in posbernoulli.t
.
Suppose the model is intercept-only.
Setting parallel.t = FALSE ~ 0
results in the drop.b = FALSE ~ 0
results in the parallel.t = FALSE ~ 0
and
setting parallel.b = FALSE ~ 0
results in the parallel.t = FALSE ~ 0
,
parallel.b = FALSE ~ 0
and
drop.b = FALSE ~ 0
results in the parallel.t
and parallel.b
may be unsuitable for data sets which have a large drop.b = TRUE ~ 0
.
The default model has a different intercept for each sampling occasion, a time-parallelism assumption for all other covariates, and a dummy variable representing a single behavioural effect (also in the intercept).
The most flexible model is to set
parallel.b = TRUE ~ 0
,
parallel.t = TRUE ~ 0
and
drop.b = TRUE ~ 0
.
This means that all possible temporal and behavioural effects are
estimated, for the intercepts and other covariates.
Such a model is not recommended; it will contain a lot of paramters.
Character, one of the choices for the type of fitted value returned.
The default is the first one.
Partial matching is okay.
For "likelihood.cond"
:
the probability defined by the conditional likelihood.
For "mean.uncond"
: the unconditional mean, which should
agree with colMeans
applied to the response
matrix for intercept-only models.
Determines the ridge parameters at each IRLS iteration.
They are the constant and power (exponent) for the ridge adjustment
for the working weight matrices (the capture probability block
matrix, hence the first wz
multipled by
ridge.constant
and ridge.power
.
This is always positive but decays to zero as iterations proceed
(provided
See posbernoulli.t
.
An object of class "vglmff"
(see vglmff-class
).
The object is used by modelling functions such as vglm
,
and vgam
.
This model
(commonly known as posbernoulli.t
for information that is in common.
It allows time and behavioural effects to be modelled.
Evidently,
the expected information matrix (EIM) seems not
of full rank (especially in early iterations), so
ridge.constant
and ridge.power
are used to
try fix up the problem.
The default link functions
are pcapture
and precapture
for the capture and recapture probabilities.
This VGAM family function may be further modified in the future.
See posbernoulli.t
.
posbernoulli.b
(including N.hat
),
posbernoulli.t
,
posbinomial
,
Select
,
fill1
,
Huggins89table1
,
Huggins89.t1
,
deermice
,
prinia
.
# NOT RUN {
# Example 1: simulated data
nTimePts <- 5 # (aka tau == # of sampling occasions)
nnn <- 1000 # Number of animals
pdata <- rposbern(n = nnn, nTimePts = nTimePts, pvars = 2)
dim(pdata); head(pdata)
M_tbh.1 <- vglm(cbind(y1, y2, y3, y4, y5) ~ x2,
posbernoulli.tb, data = pdata, trace = TRUE)
coef(M_tbh.1) # First element is the behavioural effect
coef(M_tbh.1, matrix = TRUE)
constraints(M_tbh.1, matrix = TRUE)
summary(M_tbh.1, presid = FALSE) # Standard errors are approximate
head(fitted(M_tbh.1))
head(model.matrix(M_tbh.1, type = "vlm"), 21)
dim(depvar(M_tbh.1))
M_tbh.2 <- vglm(cbind(y1, y2, y3, y4, y5) ~ x2,
posbernoulli.tb(parallel.t = FALSE ~ 0),
data = pdata, trace = TRUE)
coef(M_tbh.2) # First element is the behavioural effect
coef(M_tbh.2, matrix = TRUE)
constraints(M_tbh.2, matrix = TRUE)
summary(M_tbh.2, presid = FALSE) # Standard errors are approximate
head(fitted(M_tbh.2))
head(model.matrix(M_tbh.2, type = "vlm"), 21)
dim(depvar(M_tbh.2))
# Example 2: deermice subset data
fit1 <- vglm(cbind(y1, y2, y3, y4, y5, y6) ~ sex + weight,
posbernoulli.t, data = deermice, trace = TRUE)
coef(fit1)
coef(fit1, matrix = TRUE)
constraints(fit1, matrix = TRUE)
summary(fit1, presid = FALSE) # Standard errors are approximate
# fit1 is the same as Fit1 (a M_{th} model):
Fit1 <- vglm(cbind(y1, y2, y3, y4, y5, y6) ~ sex + weight,
posbernoulli.tb(drop.b = TRUE ~ sex + weight,
parallel.t = TRUE), # No parallelism for the intercept
data = deermice, trace = TRUE)
constraints(Fit1)
# }
Run the code above in your browser using DataLab