statsmodels.genmod.families.family.NegativeBinomial.resid_anscombe

NegativeBinomial.resid_anscombe(endog, mu)[source]

The Anscombe residuals for the negative binomial family

Parameters:

endog : array-like

Endogenous response variable

mu : array-like

Fitted mean response variable

Returns:

resid_anscombe : array

The Anscombe residuals as defined below.

Notes

resid_anscombe = (hyp2f1(-alpha*endog)-hyp2f1(-alpha*mu)+ 1.5*(endog**(2/3.)-mu**(2/3.)))/(mu+alpha*mu**2)**(1/6.)

where hyp2f1 is the hypergeometric 2f1 function parameterized as hyp2f1(x) = hyp2f1(2/3.,1/3.,5/3.,x)