'Loglikelihood of Poisson model
Parameters
params : array-like
The parameters of the model.
Returns
loglike : float
The log-likelihood function of the model evaluated at `params`.
See notes.
Notes
.. math:: \ln L=\sum_{i=1}^{n}\left[-\lambda_{i}+y_{i}x_{i}^{\prime}\beta-\ln y_{i}!\right]'

def loglike(self, params):

    offset = getattr(self, 'offset', 0)
    exposure = getattr(self, 'exposure', 0)
    XB = ((np.dot(self.exog, params) + offset) + exposure)
    endog = self.endog
    return np.sum((((- np.exp(XB)) + (endog * XB)) - gammaln((endog + 1))))
