# statsmodels.genmod.families.family.NegativeBinomial¶

Negative Binomial exponential family (corresponds to NB2).

Parameters:

alphafloat, optional

The ancillary parameter for the negative binomial distribution. For now alpha is assumed to be nonstochastic. The default value is 1. Permissible values are usually assumed to be between .01 and 2.

If True (default), then and exception is raised if the link is invalid for the family. If False, then the link is not checked.

statsmodels.genmod.families.family.Family

Notes

Power link functions are not yet supported.

Parameterization for $$y=0, 1, 2, \ldots$$ is

$f(y) = \frac{\Gamma(y+\frac{1}{\alpha})}{y!\Gamma(\frac{1}{\alpha})} \left(\frac{1}{1+\alpha\mu}\right)^{\frac{1}{\alpha}} \left(\frac{\alpha\mu}{1+\alpha\mu}\right)^y$

with $$E[Y]=\mu\,$$ and $$Var[Y]=\mu+\alpha\mu^2$$.

Attributes:

The link function of the negative binomial instance

NegativeBinomial.variancevarfunc instance

variance is an instance of statsmodels.genmod.families.varfuncs.nbinom

Methods

Methods

 deviance(endog, mu[, var_weights, ...]) The deviance function evaluated at (endog, mu, var_weights, freq_weights, scale) for the distribution. fitted(lin_pred) Fitted values based on linear predictors lin_pred. get_distribution(mu[, scale, var_weights]) Frozen NegativeBinomial distribution instance for given parameters loglike(endog, mu[, var_weights, ...]) The log-likelihood function in terms of the fitted mean response. loglike_obs(endog, mu[, var_weights, scale]) The log-likelihood function for each observation in terms of the fitted mean response for the Negative Binomial distribution. predict(mu) Linear predictors based on given mu values. resid_anscombe(endog, mu[, var_weights, scale]) The Anscombe residuals resid_dev(endog, mu[, var_weights, scale]) The deviance residuals starting_mu(y) Starting value for mu in the IRLS algorithm. weights(mu) Weights for IRLS steps

Properties