code: def _get_margeff_exog(exog, at, atexog, ind):
      if atexog is not None:  # user supplied
          if isinstance(atexog, dict):
              # assumes values are singular or of len(exog)
              for key in atexog:
                  exog[:, key] = atexog[key]
          elif isinstance(
              atexog, np.ndarray
          ):  # TODO: handle DataFrames
              if atexog.ndim == 1:
                  k_vars = len(atexog)
              else:
                  k_vars = atexog.shape[1]
              try:
                  assert k_vars == exog.shape[1]
              except:
                  raise ValueError(
                      "atexog does not have the same number "
                      "of variables as exog"
                  )
              exog = atexog
  
      # NOTE: we should fill in atexog after we process at
      if at == "mean":
          exog = np.atleast_2d(exog.mean(0))
      elif at == "median":
          exog = np.atleast_2d(np.median(exog, axis=0))
      elif at == "zero":
          exog = np.zeros((1, exog.shape[1]))
          exog[0, ~ind] = 1
      return exog
  
imports: from statsmodels.compat.python import lzip
  import numpy
  from scipy.stats import norm
  from statsmodels.tools.decorators import cache_readonly
label_desc: Use image node_id 8 for calling a global function with example usage: _get_margeff_exog(exog, at, atexog, ind) and returns: exog