class_docstr: Negative Binomial regression
  
  Parameters
  ----------
  endog : array_like
      1-d array of the response variable.
  exog : array_like
      `exog` is an n x p array where n is the number of observations and p
      is the number of regressors including the intercept if one is
      included in the data.
  ll_type: str
      log-likelihood type
      `nb2`: Negative Binomial type-2 (most common)
      `nb1`: Negative Binomial type-1
      `nbp`: Negative Binomial type-P (Greene, 2008)
      `nbt`: Left-truncated Negative Binomial (type-2)
      `geom`: Geometric regression model
  C: int
      Cut-point for `nbt` model
code: def __init__(self, endog, exog, ll_type="nb2", C=0, **kwds):
      self.exog = np.array(exog)
      self.endog = np.array(endog)
      self.C = C
      super().__init__(endog, exog, **kwds)
      # Check user input
      if ll_type not in ["nb2", "nb1", "nbp", "nbt", "geom"]:
          raise NameError(
              "Valid ll_type are: nb2, nb1, nbp,  nbt, geom"
          )
      self.ll_type = ll_type
      # Starting values (assumes first column of exog is constant)
      if ll_type == "geom":
          self.start_params_default = np.zeros(self.exog.shape[1])
      elif ll_type == "nbp":
          # Greene recommends starting NB-P at NB-2
          start_mod = NBin(endog, exog, "nb2")
          start_res = start_mod.fit(disp=False)
          self.start_params_default = np.append(start_res.params, 0)
      else:
          self.start_params_default = np.append(
              np.zeros(self.exog.shape[1]), 0.5
          )
      self.start_params_default[0] = np.log(self.endog.mean())
      # Define loglik based on ll_type argument
      if ll_type == "nb1":
          self.ll_func = _ll_nb1
      elif ll_type == "nb2":
          self.ll_func = _ll_nb2
      elif ll_type == "geom":
          self.ll_func = _ll_geom
      elif ll_type == "nbp":
          self.ll_func = _ll_nbp
      elif ll_type == "nbt":
          self.ll_func = _ll_nbt
  
imports: from urllib.request import urlopen
  import numpy
  from numpy.testing import assert_almost_equal
  from scipy.special import digamma
  from scipy.stats import nbinom
  import pandas
  import patsy
  from statsmodels.base.model import GenericLikelihoodModel
  from statsmodels.base.model import GenericLikelihoodModelResults
label_desc: Use image node_id 1 to create a new NBin object from inherited base classes: GenericLikelihoodModel with example: obj = NBin(endog, exog, ll_type, C)