Binomial.deviance()

statsmodels.genmod.families.family.Binomial.deviance

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

Deviance function for either Bernoulli or Binomial data.

Parameters:

endog : array-like

Endogenous response variable (already transformed to a probability if appropriate).

mu : array

Fitted mean response variable

scale : float, optional

An optional scale argument

Returns:

deviance : float

The deviance function as defined below

Notes

If the endogenous variable is binary:

deviance = -2*sum(I_one * log(mu) + (I_zero)*log(1-mu))

where I_one is an indicator function that evalueates to 1 if endog_i == 1. and I_zero is an indicator function that evaluates to 1 if endog_i == 0.

If the model is ninomial:

deviance = 2*sum(log(endog/mu) + (n-endog)*log((n-endog)/(n-mu))) where endog and n are as defined in Binomial.initialize.

doc_statsmodels
2017-01-18 16:07:28
Comments
Leave a Comment

Please login to continue.