def hessian(self, params, observed=None):
    'Hessian, second derivative of loglikelihood function\n\n        Parameters\n        ----------\n        params : ndarray\n            Parameter at which Hessian is evaluated.\n        observed : bool\n            If True, then the observed Hessian is returned (default).\n            If False, then the expected information matrix is returned.\n\n        Returns\n        -------\n        hessian : ndarray\n            Hessian, i.e. observed information, or expected information matrix.\n        '
    if (self.hess_type == 'eim'):
        observed = False
    else:
        observed = True
    (_, hf) = self.score_hessian_factor(params, return_hessian=True, observed=observed)
    (hf11, hf12, hf22) = hf
    d11 = (self.exog.T * hf11).dot(self.exog)
    d12 = (self.exog.T * hf12).dot(self.exog_precision)
    d22 = (self.exog_precision.T * hf22).dot(self.exog_precision)
    return np.block([[d11, d12], [d12.T, d22]])
Hessian, second derivative of loglikelihood function

Parameters
----------
params : ndarray
    Parameter at which Hessian is evaluated.
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, observed=None):
    'Hessian, second derivative of loglikelihood function\n\n        Parameters\n        ----------\n        params : ndarray\n            Parameter at which Hessian is evaluated.\n        observed : bool\n            If True, then the observed Hessian is returned (default).\n            If False, then the expected information matrix is returned.\n\n        Returns\n        -------\n        hessian : ndarray\n            Hessian, i.e. observed information, or expected information matrix.\n        '
    if (self.hess_type == 'eim'):
        observed = False
    else:
        observed = True
    (_, hf) = self.score_hessian_factor(params, return_hessian=True, observed=observed)
    (hf11, hf12, hf22) = hf
    d11 = (self.exog.T * hf11).dot(self.exog)
    d12 = (self.exog.T * hf12).dot(self.exog_precision)
    d22 = (self.exog_precision.T * hf22).dot(self.exog_precision)
    return np.block([[d11, d12], [d12.T, d22]])