Deviance function for either Bernoulli or Binomial data.
Parameters : | Y : 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 Y_i == 1. and I_zero is an indicator function that evaluates to 1 if Y_i == 0.
If the model is ninomial:
deviance = 2*sum(log(Y/mu) + (n-Y)*log((n-Y)/(n-mu))) where Y and n are as defined in Binomial.initialize.