Learn R Programming

spaMM (version 4.2.1)

negbin1: Alternative negative-binomial family

Description

Returns a family object suitable as a fitme argument for fitting negative-binomial models with variance linearly (affinely) related to the mean \(\mu\): variance=\(\mu+\mu\)/shape, with known or unknown underlying Gamma shape parameter. The model described by such a family is characterized by a linear predictor, a link function, and such a negative-binomial model for the residual variation. The zero-truncated variant of this family is also handled.

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 shape parameter. Thus the variance of the response become \(\mu+\mu\)/exp(<specified linear expression>).

Usage

negbin1(shape = stop("negbin1's 'shape' must be specified"), link = "log", trunc = -1L)

Value

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

Arguments

shape

Parameter controlling the mean-variance relationship of the negative binomial distribution. Given that the distribution can be represented as a Poisson-Gamma mixture, where the conditional Poisson mean is \(\mu\) times a Gamma random variable with mean 1 and (distinct) shape sh (as produced by rgamma(., shape=sh,scale=1/sh)), the latter shape is then determined as sh=shape*\(\mu\).

link

log, sqrt or identity 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).

trunc

Either 0L for zero-truncated distribution, or -1L for default untruncated distribution.

Details

The name NB_shape should be used to set values of shape in control arguments of the fitting functions (e.g., fitme(.,init=list(NB_shape=1))).

See Also

Examples in LL-family. resid.model for an example with a residual-dispersion model.