7.2.3.3.2.4. statsmodels.genmod.families.family.Binomial.loglike

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

Loglikelihood function for Binomial exponential family distribution.

Parameters:

endog : array-like

Endogenous response variable

mu : array-like

Fitted mean response variable

scale : float, optional

The default is 1.

Returns:

llf : float

The value of the loglikelihood function evaluated at (endog,mu,scale) as defined below.

Notes

If endog is binary: llf = scale*sum(endog*log(mu/(1-mu))+log(1-mu))

If endog is binomial: llf = scale*sum(gammaln(n+1) - gammaln(y+1) - gammaln(n-y+1) + y*log(mu/(1-mu)) + n*log(1-mu)

where gammaln is the log gamma function and y = endog*n with endog and n as defined in Binomial initialize. This simply makes y the original number of successes.