Deviance function for either Bernoulli or Binomial data.
Parameters: | endog : array-like
mu : array
scale : float, optional
|
---|---|
Returns: | deviance : float
|
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.