betabin: Beta-binomial family object

betabinR Documentation

Beta-binomial family object

Description

Returns a family object for beta-binomial models. The model described by such a family is characterized by a linear predictor, a link function, and the beta-binomial distribution for residual variation.

The precision parameter prec of this family is a positive value such that the variance of the beta-distributed latent variable given its mean \mu is \mu(1-\mu)/(1+prec). prec is thus the same precision parameter as for the beta response family (see beta_resp. The variance of the beta-binomial sample of size n is response is \mu(1-\mu)n(n+prec)/(1+prec).

A fixed-effect residual-dispersion model can be fitted, using the resid.model argument, which is used to specify the form of the logarithm of the precision parameter (see Examples). Thus the variance of the latent beta-distributed variable becomes \mu(1-\mu)/(1+exp(<specified linear expression>)).

Usage

betabin(prec = stop("betabin's 'prec' must be specified"), link = "logit")

Arguments

prec

Scalar (or left unspecified): precision parameter of the beta distribution.

link

logit, probit, cloglog or cauchit link, specified by any of the available ways for GLM links (name, character string, one-element character vector, or object of class link-glm as returned by make.link).

Details

Prior weights are meaningful for this family and handled as a factor of the precision parameter of the latent beta-distributed variable: the variance of the latent variable become \mu(1-\mu)/(1+prec*<prior weights>). However, this feature is experimental and may be removed in the future. The fitting function's resid.model argument may be preferred to obtain the same effect, by specifying an offset(log(<prior weights>)) in its formula (given the log link used in that model). As usual in spaMM, the offset(.) argument should be a vector and any variable necessary for evaluating it should be in the data.

Value

A list, formally of class c("LLF", "family"). See LL-family for details about the structure and usage of such objects.

Examples

if (requireNamespace("agridat", quietly = TRUE)) {
  data("crowder.seeds", package = "agridat")
  fitme(cbind(germ,n-germ) ~ gen+extract+(1|plate), data=crowder.seeds, family=betabin())
} else {
  data(clinics)
  fitme(cbind(npos,nneg)~1+(1|clinic), family=betabin(), data=clinics)
}

spaMM documentation built on June 22, 2024, 9:48 a.m.

Related to betabin in spaMM...