Logo

statsmodels.genmod.families.family.Binomial.resid_dev

Binomial.resid_dev(Y, mu, scale=1.0)[source]

Binomial deviance residuals

Parameters:

Y : array-like

Endogenous response variable

mu : array-like

Fitted mean response variable

scale : float, optional

An optional argument to divide the residuals by scale

Returns:

resid_dev : array

Deviance residuals as defined below

Notes

If Y is binary:

resid_dev = sign(Y-mu)*sqrt(-2*log(I_one*mu + I_zero*(1-mu)))

where I_one is an indicator function that evaluates as 1 if Y == 1 and I_zero is an indicator function that evaluates as 1 if Y == 0.

If Y is binomial:

resid_dev = sign(Y-mu)*sqrt(2*n*(Y*log(Y/mu)+(1-Y)*log((1-Y)/(1-mu))))

where Y and n are as defined in Binomial.initialize.

Previous topic

statsmodels.genmod.families.family.Binomial.resid_anscombe

Next topic

statsmodels.genmod.families.family.Binomial.starting_mu

This Page