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

Loglikelihood function for Binomial exponential family distribution.


endog : array-like

Endogenous response variable

mu : array-like

Fitted mean response variable

scale : float, optional

The default is 1.


llf : float

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


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.