7.2.3.3.6.1. statsmodels.genmod.families.family.NegativeBinomial.deviance

NegativeBinomial.deviance(endog, mu, scale=1.0)[source]

Returns the value of the deviance function.

Parameters:

endog : array-like

Endogenous response variable

mu : array-like

Fitted mean response variable

scale : float, optional

An optional scale argument

Returns:

deviance : float

Deviance function as defined below

Notes

deviance = sum(piecewise)

where piecewise is defined as

If \(Y_{i} == 0\):

\[piecewise_i = 2\log(1+\alpha*\mu)/\alpha\]

If \(Y_{i} > 0\):

\[piecewise_i = math2 Y \log(Y/\mu)-2/\alpha(1+\alpha Y) * \log((1+\alpha Y)/(1+\alpha\mu))\]