class_docstr: Maximum Likelihood Estimation of Poisson Model
  
  This is an example for generic MLE which has the same statistical model
  as discretemod.Poisson but adds offset and zero-inflation.
  
  Except for defining the negative log-likelihood method, all
  methods and results are generic. Gradients and Hessian
  and all resulting statistics are based on numerical
  differentiation.
  
  There are numerical problems if there is no zero-inflation.
class_docstr_tok: ["Maximum","Likelihood","Estimation","of","Poisson","Model","This","is","an","example","for","generic","MLE","which","has","the","same","statistical","model","as","discretemod.Poisson","but","adds","offset","and","zero-inflation",".","Except","for","defining","the","negative","log-likelihood","method",",","all","methods","and","results","are","generic",".","Gradients","and","Hessian","and","all","resulting","statistics","are","based","on","numerical","differentiation",".","There","are","numerical","problems","if","there","is","no","zero-inflation","."]
docstr: Loglikelihood of Poisson model
  
  Parameters
  ----------
  params : array_like
      The parameters of the model.
  
  Returns
  -------
  The log likelihood of the model evaluated at `params`
  
  Notes
  -----
  .. math:: \ln L=\sum_{i=1}^{n}\left[-\lambda_{i}+y_{i}x_{i}^{\prime}\beta-\ln y_{i}!\right]
docstr_tok: ["Loglikelihood","of","Poisson","model","Parameters","--","--","--","--","--","params",":","array_like","The","parameters","of","the","model",".","Returns","--","--","--","-","The","log","likelihood","of","the","model","evaluated","at","`","params","`","Notes","--","--","-","..","math",":",":","\\ln","L=\\sum_","{","i=1","}","^","{","n","}","\\left","[","-\\lambda_","{","i","}","+y_","{","i","}","x_","{","i","}","^","{","\\prime","}","\\beta-\\ln","y_","{","i","}","!","\\right","]"]
code: def nloglikeobs(self, params):
      """
      Loglikelihood of Poisson model
  
      Parameters
      ----------
      params : array_like
          The parameters of the model.
  
      Returns
      -------
      The log likelihood of the model evaluated at `params`
  
      Notes
      -----
      .. math:: \\ln L=\\sum_{i=1}^{n}\\left[-\\lambda_{i}+y_{i}x_{i}^{\\prime}\\beta-\\ln y_{i}!\\right]
      """
      beta = params[:-1]
      gamm = 1 / (1 + np.exp(params[-1]))  # check this
      # replace with np.dot(self.exogZ, gamma)
      # print(np.shape(self.offset), self.exog.shape, beta.shape
      XB = self.offset + np.dot(self.exog, beta)
      endog = self.endog
      nloglik = (
          -np.log(1 - gamm)
          + np.exp(XB)
          - endog * XB
          + np.log(factorial(endog))
      )
      nloglik[endog == 0] = -np.log(gamm + np.exp(-nloglik[endog == 0]))
  
      return nloglik
  
file_path: statsmodels/statsmodels/miscmodels/count.py
imports: import numpy
  from scipy import stats
  from scipy.special import factorial
  from statsmodels.base.model import GenericLikelihoodModel
label_desc: Use image node_id 2 for calling the PoissonZiGMLE obj's underlying member method code with example usage: obj.nloglikeobs(params) and returns: nloglik