Skip to contents

Overview of the count distributions that can be used as the family of countreg() and countreg_rp(): their distribution parameters (the parameters modeled by dis_param_formula_1 and dis_param_formula_2), variances, distribution functions, and the model features available for each.

Details

In every family the mean model is \(\mu = \exp(X\beta)\) (times the exposure given by an offset, and the reporting probability in an underreporting model). The distribution parameters are \(\exp(W\delta)\), where \(W\) is the design matrix of dis_param_formula_1 or dis_param_formula_2 (an intercept when the formula is not given); the coefficient labels in the fitted model show the scale of \(W\delta\). For example ln(alpha) means \(\alpha = \exp(W\delta)\), logit(rho) means \(\rho = 1 / (1 + \exp(-W\delta))\), and the Sichel gamma is \(W\delta\) itself.

In the variance column, \(\mu\) is the mean parameter \(\exp(X\beta)\); it is the mean of the distribution except where noted. A = digamma(k + 1) - digamma(1) and B = trigamma(1) - trigamma(k + 1) for a generalized exponential shape k, and \(M_2 = 1 + B / A^2\). Family names are not case-sensitive and non-alphanumeric characters are ignored ("nb-2" is "NB2").

Parameters and moments

familyDistributiondis_param_formula_1dis_param_formula_2Variance
POISSONPoisson––mu
NB1Negative binomial 1ln(alpha)–mu * (1 + alpha)
NB2Negative binomial 2ln(alpha)–mu + alpha * mu^2
NBPNegative binomial Pln(alpha)ln(p)mu + alpha * mu^p
GP1Generalized Poisson 1ln(phi+1)–(1 + phi)^2 * mu for phi >= 0 (1)
GP2Generalized Poisson 2ln(alpha+1)–(1 + alpha * mu)^2 * mu for alpha >= 0 (1)
COMConway-Maxwell-Poissonln(nu)–computed numerically
PLNPoisson-lognormalln(sigma)–m + (exp(sigma^2) - 1) * m^2, mean m = mu * exp(sigma^2 / 2)
PGEPoisson-generalized exponentialln(shape)–mu + mu^2 * B / A^2
PIG1Poisson-inverse Gaussian 1ln(eta)–mu * (1 + eta)
PIG2Poisson-inverse Gaussian 2ln(eta)–mu + eta * mu^2
PIGPoisson-inverse gammaln(eta)–mu + eta * mu^2
PLPoisson-Lindleyln(theta)–mu + mu^2 * (1 - 2 / (theta + 2)^2)
PLGPoisson-Lindley-gamma (negative binomial-Lindley)ln(theta)ln(alpha)mu + ((1 + alpha) * (2 - 2 / (theta + 2)^2) - 1) * mu^2
PLLPoisson-Lindley-lognormalln(theta)ln(sigma)m + ((2 - 2 / (theta + 2)^2) * exp(sigma^2) - 1) * m^2, mean m = mu * exp(sigma^2 / 2)
PWPoisson-Weibullln(alpha)–mu + (gamma(1 + 2 / alpha) / gamma(1 + 1 / alpha)^2 - 1) * mu^2
SISichelgamma (identity link)ln(sigma)see dsichel()
GWGeneralized Waringln(k)ln(rho-1)finite only for rho > 2; see dgwar()
DWDiscrete Weibullln(shape)–computed numerically (2)
DPODouble Poissonln(phi)–computed numerically, about mu / phi (2)
DELAPORTEDelaportelogit(rho)ln(k)mu + (rho * mu)^2 / k
HERMITEHermite (order 2)logit(rho)–mu * (1 + rho)
HERMITE3Generalized Hermite, order 3logit(rho)–mu * (1 + 2 * rho)
HERMITE4Generalized Hermite, order 4logit(rho)–mu * (1 + 3 * rho)
HYPERPOISHyper-Poissonln(gamma)–computed numerically (2)
GAMMACOUNTGamma renewal countln(shape)–computed numerically (2)
PAPolya-Aeppli (Poisson-Tweedie, power 1.5)ln(phi)–mu + phi * mu^1.5
NBGENegative binomial-generalized exponentialln(shape)ln(alpha)mu + ((1 + alpha) * M2 - 1) * mu^2

(1) With a negative dispersion parameter the generalized Poisson distributions are truncated and renormalized, \(\mu\) is a location parameter, and the moments are computed from the renormalized probabilities (see countreg()).

(2) The natural parameter of each observation is found by solving the mean equation numerically, so \(\mu\) is exactly the mean. These families are slower to fit, especially in countreg_rp(); their shape parameter must lie in \([10^{-6}, 10^6]\) and the mean be at most \(10^9\) (outside this numerical domain the likelihood is treated as 0).

Distribution functions and model features

The distribution functions use each distribution's own parameterization, which can differ from the regression parameterization (see each help page). "Underreporting" is the binomial-thinning model of underreport_formula; it requires the reported counts to follow the same family. "LR vs Poisson" is the likelihood-ratio test reported by summary.flexCountReg(): "boundary" when Poisson is on the edge of the parameter space (50:50 chi-square mixture), "interior" when it is an interior special case, and "–" when no regular test exists.

familyDistribution functionsUnderreportingLR vs Poisson
POISSONstats::dpois()yes–
NB1stats::dnbinom() with size = mu / alphayesboundary
NB2stats::dnbinom() with size = 1 / alphayesboundary
NBPstats::dnbinom() with size = mu^(2 - p) / alphayes–
GP1dgp1()–interior
GP2dgp2()–interior
COMdcom()–interior
PLNdpLnorm()yesboundary
PGEdpge()yes–
PIG1dpinvgaus()yesboundary
PIG2dpinvgaus() with form = "Type 2"yesboundary
PIGdpinvgamma()yesboundary
PLdplind()yes–
PLGdplindGamma()yes–
PLLdplindLnorm()yes–
PWdpoisweibull()yes–
SIdsichel()yes–
GWdgwar()––
DWddweib()––
DPOddpo()–interior
DELAPORTEddelaporte()yes–
HERMITEdghermite() with m = 2yes (rho becomes p * rho)–
HERMITE3dghermite() with m = 3––
HERMITE4dghermite() with m = 4––
HYPERPOISdhpois()–interior
GAMMACOUNTdgcount()–interior
PAdpaeppli()yes (phi becomes sqrt(p) * phi)–
NBGEdnbge()yes–

Zero inflation and hurdles (zero_formula) are available for every family in countreg(), and every family can be used with random parameters in countreg_rp() (GP2 only with a nonnegative dispersion).

Finite mixtures and latent classes

Every family can be a component of a finite mixture or latent-class model (countreg_mix(), countreg_lc()), with the same component density, mean, variance, distribution function and random generator as in countreg() (one-component mixtures reproduce countreg()). Mixtures of POISSON, NB1 and NB2 components are validated (analytic scores, independent likelihood checks and simulation recovery in the tests). Mixtures of the other families are experimental: they are computed correctly, but how well their components and mixing proportions can be recovered has not been studied, and adding outer components to a family that already mixes over a continuous random effect (PLN, PGE, PLL, NBGE, and others) can make the model weakly identified. A finite mixture selects one component and draws one count from it; it is not a convolution (a sum of counts) and not the within-family mixing of these families. A Generalized Waring component with \(\rho \le 2\) has an infinite variance, so the mixture variance is infinite and Pearson residuals are not available.

Underreporting and the variance of the reported counts

In an underreporting model the true count \(Y\) has mean \(\mu = \exp(X\beta)\) and variance \(V\), as in the first table, and each event is reported independently with probability \(p = F(Z\gamma)\) (\(F\) the logistic or normal distribution function of underreport_family, \(Z\) the design matrix of underreport_formula). The reported count is a binomial thinning of the true count, \(Y^* \mid Y \sim \mathrm{Binomial}(Y, p)\), so by the laws of total expectation and variance $$E[Y^*] = p\mu, \qquad \mathrm{Var}(Y^*) = p^2 V + p(1 - p)\mu.$$ The second term is the binomial reporting noise. In terms of the dispersion index (variance-to-mean ratio) \(D = V / \mu\) of the true counts, the reported counts have $$D^* = \frac{\mathrm{Var}(Y^*)}{E[Y^*]} = 1 + p(D - 1).$$ Underreporting therefore shrinks any departure from the Poisson variance by the factor \(p\): the reported counts are less overdispersed (or less underdispersed) than the true counts, and a Poisson true count stays Poisson. The same \(p\) lowers the mean and shrinks the excess variance; a heavily underreported outcome can look close to Poisson even when the true counts are strongly overdispersed.

For the families that allow underreporting, the reported counts follow the same family, with mean parameter \(p\mu\) (written m below; it is the reported mean except for PLN and PLL, whose mean is \(p\mu\exp(\sigma^2 / 2)\)) and the distribution parameters shown below (the estimated distribution parameters are those of the true counts):

familyVariance of the reported counts (m = p * mu)Reported-count parameters
POISSONm–
NB1m * (1 + p * alpha)p * alpha
NB2m + alpha * m^2unchanged
NBPm + alpha * p^(2 - P) * m^Palpha * p^(2 - P)
PIG1m * (1 + p * eta)p * eta
PIG2, PIGm + eta * m^2unchanged
PLN, PGE, PL, PLG, PLL, PW, SI, NBGEthe variance formula of the first table, evaluated at the mean parameter p * muunchanged
DELAPORTEm + (rho * m)^2 / kunchanged
HERMITEm * (1 + p * rho)p * rho
PAm + sqrt(p) * phi * m^1.5sqrt(p) * phi

Two consequences for interpretation:

  • For NB2, PIG2, PIG, DELAPORTE and the mixed Poisson families whose mixing distribution does not depend on the mean (PLN, PGE, PL, PLG, PLL, PW, SI and NBGE), the excess variance is quadratic in the mean and the distribution parameters are the same for true and reported counts: the variance of the reported counts is the family variance at the reported mean parameter. For NB1, PIG1, NBP, HERMITE and PA, the dispersion of the reported counts depends on \(p\), so observations with different reporting probabilities have different reported-count dispersion even with a constant dispersion parameter.

  • The reporting probability is identified mainly through variables that affect reporting but not the true counts (see underreport_formula in countreg()). For NB1, PIG1, NBP, HERMITE and PA the dependence of the reported dispersion on \(p\) adds some information, but it is confounded with the dispersion parameter itself and should not be relied on to separate \(\mu\) from \(p\).

Fitted values and diagnostics use the reported counts: predict(type = "response") is \(p\mu\), predict(type = "true") is \(\mu\) and predict(type = "prob_reported") is \(p\); Pearson residuals divide by the reported-count variance \(\mathrm{Var}(Y^*)\); and quantile residuals, rootograms and simulate() use the reported-count distribution. The reporting probability is a fixed function of the covariates: extra variation in reporting between observations with the same covariates is not part of the model.

Examples

# The same mean model with two dispersion-flexible families
data("washington_roads")
f <- Total_crashes ~ lnaadt + lnlength + speed50
fit_nb2 <- countreg(f, data = washington_roads, family = "NB2",
                    method = "BFGS")
fit_pa <- countreg(f, data = washington_roads, family = "PA",
                   method = "BFGS")
c(NB2 = AIC(fit_nb2), PA = AIC(fit_pa))
#>      NB2       PA 
#> 2179.884 2179.167