Learn R Programming

spaMM (version 4.7.0)

betabin: Beta-binomial family object

Description

Returns a family object for beta-binomial models. 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 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).

The family described by this object is not a GLM family, so it should not be used as a glm argument unless one additionally uses method="llm.fit" (see Examples). But it is still characterized by the same concepts as GLMs: a linear predictor, a link function, and the given distribution of residual variation.

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, link = "logit")

Value

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

Arguments

prec

Scalar (or left unspecified): precision parameter of the beta distribution. The “outer-optimizing” functions, such as fitme (see inner-vs-outer) will estimate this parameter if called with family=betabin() (no given prec value). In other usages of this family, prec must be specified.

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.

Examples

Run this code
  data(clinics)
  fitme(cbind(npos,nneg)~1+(1|clinic), family=betabin(), data=clinics)
  
  # Compatibility with glm(., method="llm.fit"):
  glm(cbind(npos,nneg)~1, family=betabin(2), data=clinics, 
      method="llm.fit")
  # (trying to use default method=stats::glm.fit in this case will fail).

Run the code above in your browser using DataLab