'Hessian, second derivative of loglikelihood function
Parameters
params : ndarray
parameter at which Hessian is evaluated
scale : None or float
If scale is None, then the default scale will be calculated.
Default scale is defined by `self.scaletype` and set in fit.
If scale is not None, then it is used as a fixed scale.
observed : bool
If True, then the observed Hessian is returned (default).
If false then the expected information matrix is returned.
Returns
hessian : ndarray
Hessian, i.e. observed information, or expected information matrix.'

def hessian(self, params, scale=None, observed=None):

    if (observed is None):
        if (hasattr(self, '_optim_hessian') and (self._optim_hessian == 'eim')):
            observed = False
        else:
            observed = True
    factor = self.hessian_factor(params, scale=scale, observed=observed)
    hess = (- np.dot((self.exog.T * factor), self.exog))
    return hess
