docstr: 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.
docstr_tok: ["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","."]
code: def hessian(self, params, observed=None):
      """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.
      """
      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
  
      # elementwise product for each row (observation)
      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]])
  
imports: import numpy
  from scipy.special import gammaln
  import patsy
  import statsmodels.base.wrapper
  import statsmodels.regression.linear_model
  from statsmodels.tools.decorators import cache_readonly
  from statsmodels.base.model import GenericLikelihoodModel, GenericLikelihoodModelResults, _LLRMixin
  from statsmodels.genmod import families
label_desc: Use image node_id 14 for calling the BetaModel obj's underlying member method code with example usage: obj.hessian(params, observed) and returns: np