statsmodels.genmod.families.family.NegativeBinomial.resid_dev

NegativeBinomial.resid_dev(endog, mu, var_weights=1.0, scale=1.0)

The deviance residuals

Parameters:
  • endog (array-like) – The endogenous response variable
  • mu (array-like) – The inverse of the link function at the linear predicted values.
  • var_weights (array-like) – 1d array of variance (analytic) weights. The default is 1.
  • scale (float, optional) – An optional scale argument. The default is 1.
Returns:

resid_dev – Deviance residuals as defined below.

Return type:

float

Notes

The deviance residuals are defined by the contribution D_i of observation i to the deviance as

\[resid\_dev_i = sign(y_i-\mu_i) \sqrt{D_i}\]

D_i is calculated from the _resid_dev method in each family. Distribution-specific documentation of the calculation is available there.