statsmodels.genmod.families.family.NegativeBinomial.loglike

NegativeBinomial.loglike(endog, mu, scale)[source]

The log-likelihood function in terms of the fitted mean response.

Parameters:

endog : array-like

Endogenous response variable

mu : array-like

The fitted mean response values

scale : float

The scale parameter

Returns:

llf : float

The value of the loglikelihood function evaluated at (endog,mu,scale) as defined below.

Notes

sum(endog*log(alpha*exp(lin_pred)/(1+alpha*exp(lin_pred))) -
log(1+alpha*exp(lin_pred))/alpha + constant)

where constant is defined as:

constant = gammaln(endog + 1/alpha) - gammaln(endog + 1) -
           gammaln(1/alpha)