code: def momentcondquant(distfn, params, mom2, quantile=None, shape=None):
      """moment conditions for estimating distribution parameters by matching
      quantiles, defines as many moment conditions as quantiles.
  
      Returns
      -------
      difference : ndarray
          difference between theoretical and empirical quantiles
  
      Notes
      -----
      This can be used for method of moments or for generalized method of
      moments.
  
      """
      # this check looks redundant/unused know
      if len(params) == 2:
          loc, scale = params
      elif len(params) == 3:
          shape, loc, scale = params
      else:
          # raise NotImplementedError
          pass  # see whether this might work, seems to work for beta with 2 shape args
  
      # mom2diff = np.array(distfn.stats(*params)) - mom2
      # if not quantile is None:
      pq, xq = quantile
      # ppfdiff = distfn.ppf(pq, alpha)
      cdfdiff = distfn.cdf(xq, *params) - pq
      # return np.concatenate([mom2diff, cdfdiff[:1]])
      return cdfdiff
  
file_path: statsmodels/statsmodels/sandbox/distributions/estimators.py
imports: import numpy
  from scipy import stats, optimize, special
label_desc: Use image node_id 5 for calling a global function with example usage: momentcondquant(distfn, params, mom2, quantile, shape) and returns: cdfdiff