code: def __init__(self, endog, exog, missing="none", **kwargs):
      if "groups" not in kwargs:
          raise ValueError("'groups' is a required argument")
      groups = kwargs["groups"]
  
      if groups.size != endog.size:
          msg = "'endog' and 'groups' should have the same dimensions"
          raise ValueError(msg)
  
      if exog.shape[0] != endog.size:
          msg = "The leading dimension of 'exog' should equal the length of 'endog'"
          raise ValueError(msg)
  
      super().__init__(endog, exog, missing=missing, **kwargs)
  
      if self.data.const_idx is not None:
          msg = (
              "Conditional models should not have an intercept in the "
              + "design matrix"
          )
          raise ValueError(msg)
  
      exog = self.exog
      self.k_params = exog.shape[1]
  
      # Get the row indices for each group
      row_ix = {}
      for i, g in enumerate(groups):
          if g not in row_ix:
              row_ix[g] = []
          row_ix[g].append(i)
  
      # Split the data into groups and remove groups with no variation
      endog, exog = np.asarray(endog), np.asarray(exog)
      offset = kwargs.get("offset")
      self._endog_grp = []
      self._exog_grp = []
      self._groupsize = []
      if offset is not None:
          offset = np.asarray(offset)
          self._offset_grp = []
      self._offset = []
      self._sumy = []
      self.nobs = 0
      drops = [0, 0]
      for g, ix in row_ix.items():
          y = endog[ix].flat
          if np.std(y) == 0:
              drops[0] += 1
              drops[1] += len(y)
              continue
          self.nobs += len(y)
          self._endog_grp.append(y)
          if offset is not None:
              self._offset_grp.append(offset[ix])
          self._groupsize.append(len(y))
          self._exog_grp.append(exog[ix, :])
          self._sumy.append(np.sum(y))
  
      if drops[0] > 0:
          msg = (
              "Dropped %d groups and %d observations for having "
              + "no within-group variance"
          ) % tuple(drops)
          warnings.warn(msg)
  
      # This can be pre-computed
      if offset is not None:
          self._endofs = []
          for k, ofs in enumerate(self._offset_grp):
              self._endofs.append(np.dot(self._endog_grp[k], ofs))
  
      # Number of groups
      self._n_groups = len(self._endog_grp)
  
      # These are the sufficient statistics
      self._xy = []
      self._n1 = []
      for g in range(self._n_groups):
          self._xy.append(np.dot(self._endog_grp[g], self._exog_grp[g]))
          self._n1.append(np.sum(self._endog_grp[g]))
  
imports: import numpy
  import statsmodels.base.model
  import statsmodels.regression.linear_model
  import statsmodels.base.wrapper
  from statsmodels.discrete.discrete_model import MultinomialResults, MultinomialResultsWrapper
  import collections
  import warnings
  import itertools
label_desc: Use image node_id 1 to create a new _ConditionalModel object from inherited base classes: base with example: obj = _ConditionalModel(endog, exog, missing)