Learn R Programming

glmmTMB (version 1.1.10)

nbinom2: Family functions for glmmTMB

Description

Family functions for glmmTMB

Usage

nbinom2(link = "log")

nbinom1(link = "log")

compois(link = "log")

truncated_compois(link = "log")

genpois(link = "log")

truncated_genpois(link = "log")

truncated_poisson(link = "log")

truncated_nbinom2(link = "log")

truncated_nbinom1(link = "log")

beta_family(link = "logit")

betabinomial(link = "logit")

tweedie(link = "log")

skewnormal(link = "identity")

lognormal(link = "log")

ziGamma(link = "inverse")

t_family(link = "identity")

ordbeta(link = "logit")

nbinom12(link = "log")

bell(link = "log")

Value

returns a list with (at least) components

family

length-1 character vector giving the family name

link

length-1 character vector specifying the link function

variance

a function of either 1 (mean) or 2 (mean and dispersion parameter) arguments giving a value proportional to the predicted variance (scaled by sigma(.))

Arguments

link

(character) link function for the conditional mean ("log", "logit", "probit", "inverse", "cloglog", "identity", or "sqrt")

Details

If specified, the dispersion model uses a log link. Denoting the variance as \(V\), the dispersion parameter as \(\phi=\exp(\eta)\) (where \(\eta\) is the linear predictor from the dispersion model), and the predicted mean as \(\mu\):

gaussian

(from base R): constant \(V=\phi^2\)

Gamma

(from base R) phi is the shape parameter. \(V=\mu\phi\)

ziGamma

a modified version of Gamma that skips checks for zero values, allowing it to be used to fit hurdle-Gamma models

nbinom2

Negative binomial distribution: quadratic parameterization (Hardin & Hilbe 2007). \(V=\mu(1+\mu/\phi) = \mu+\mu^2/\phi\).

nbinom1

Negative binomial distribution: linear parameterization (Hardin & Hilbe 2007). \(V=\mu(1+\phi)\). Note that the \(phi\) parameter has opposite meanings in the nbinom1 and nbinom2 families. In nbinom1 overdispersion increases with increasing phi (the Poisson limit is phi=0); in nbinom2 overdispersion decreases with increasing phi (the Poisson limit is reached as phi goes to infinity).

nbinom12

Negative binomial distribution: mixed linear/quadratic, as in the DESeq2 package or as described by Lindén and Mäntyniemi (2011). \(V=\mu(1+\phi+\mu/psi)\). (In Lindén and Mäntyniemi's parameterization, \(\omega = \phi\) and \(\theta=1/\psi\).) If a dispersion model is specified, it applies only to the linear (phi) term.

truncated_nbinom2

Zero-truncated version of nbinom2: variance expression from Shonkwiler 2016. Simulation code (for this and the other truncated count distributions) is taken from C. Geyer's functions in the aster package; the algorithms are described in this vignette.

compois

Conway-Maxwell Poisson distribution: parameterized with the exact mean (Huang 2017), which differs from the parameterization used in the COMPoissonReg package (Sellers & Shmueli 2010, Sellers & Lotze 2015). \(V=\mu\phi\).

genpois

Generalized Poisson distribution (Consul & Famoye 1992). \(V=\mu\exp(\eta)\). (Note that Consul & Famoye (1992) define \(\phi\) differently.) Our implementation is taken from the HMMpa package, based on Joe and Zhu (2005) and implemented by Vitali Witowski.

beta

Beta distribution: parameterization of Ferrari and Cribari-Neto (2004) and the betareg package (Cribari-Neto and Zeileis 2010); \(V=\mu(1-\mu)/(\phi+1)\)

betabinomial

Beta-binomial distribution: parameterized according to Morris (1997). \(V=\mu(1-\mu)(n(\phi+n)/(\phi+1))\)

tweedie

Tweedie distribution: \(V=\phi\mu^power\). The power parameter is restricted to the interval \(1<power<2\), i.e. the compound Poisson-gamma distribution. Code taken from the tweedie package, written by Peter Dunn. The power parameter (designated psi in the list of parameters) uses the link function qlogis(psi-1.0); thus one can fix the power parameter to a specified value using start = list(psi = qlogis(fixed_power-1.0)), map = list(psi = factor(NA)).

t_family

Student-t distribution with adjustable scale and location parameters (also called a Pearson type VII distribution). The shape (degrees of freedom parameter) is fitted with a log link; it may be often be useful to fix the shape parameter using start = list(psi = log(fixed_df)), map = list(psi = factor(NA)).

ordbeta

Ordered beta regression from Kubinec (2022); fits continuous (e.g. proportion) data in the closed interval [0,1]. Unlike the implementation in the ordbeta package, this family will not automatically scale the data. If your response variable is defined on the closed interval [a,b], transform it to [0,1] via y_scaled <- (y-a)/(b-a).

lognormal

Log-normal, parameterized by the mean and standard deviation on the data scale

skewnormal

Skew-normal, parameterized by the mean, standard deviation, and shape (Azzalini & Capitanio, 2014); constant \(V=\phi^2\)

bell

Bell distribution (see Castellares et al 2018).

References

  • Azzalini A & Capitanio A (2014). "The skew-normal and related families." Cambridge: Cambridge University Press.

  • Castellares F, Ferrari SLP, & Lemonte AJ (2018) "On the Bell Distribution and Its Associated Regression Model for Count Data" Applied Mathematical Modelling 56: 172–85. tools:::Rd_expr_doi("10.1016/j.apm.2017.12.014")

  • Consul PC & Famoye F (1992). "Generalized Poisson regression model." Communications in Statistics: Theory and Methods 21:89–109.

  • Ferrari SLP, Cribari-Neto F (2004). "Beta Regression for Modelling Rates and Proportions." J. Appl. Stat. 31(7), 799-815.

  • Hardin JW & Hilbe JM (2007). "Generalized linear models and extensions." Stata Press.

  • Huang A (2017). "Mean-parametrized Conway–Maxwell–Poisson regression models for dispersed counts." Statistical Modelling 17(6), 1-22.

  • Joe H & Zhu R (2005). "Generalized Poisson Distribution: The Property of Mixture of Poisson and Comparison with Negative Binomial Distribution." Biometrical Journal 47(2): 219–29. tools:::Rd_expr_doi("10.1002/bimj.200410102").

  • Lindén, A & Mäntyniemi S. (2011). "Using the Negative Binomial Distribution to Model Overdispersion in Ecological Count Data." Ecology 92 (7): 1414–21. tools:::Rd_expr_doi("10.1890/10-1831.1").

  • Morris W (1997). "Disentangling Effects of Induced Plant Defenses and Food Quantity on Herbivores by Fitting Nonlinear Models." American Naturalist 150:299-327.

  • Kubinec R (2022). "Ordered Beta Regression: A Parsimonious, Well-Fitting Model for Continuous Data with Lower and Upper Bounds." Political Analysis. doi:10.1017/pan.2022.20.

  • Sellers K & Lotze T (2015). "COMPoissonReg: Conway-Maxwell Poisson (COM-Poisson) Regression". R package version 0.3.5. https://CRAN.R-project.org/package=COMPoissonReg

  • Sellers K & Shmueli G (2010) "A Flexible Regression Model for Count Data." Annals of Applied Statistics 4(2), 943–61. tools:::Rd_expr_doi("10.1214/09-AOAS306").

  • Shonkwiler, J. S. (2016). "Variance of the truncated negative binomial distribution." Journal of Econometrics 195(2), 209–210. tools:::Rd_expr_doi("10.1016/j.jeconom.2016.09.002").