class_docstr: mixtures with a discrete distribution
  
  The mixing distribution is a discrete distribution like scipy.stats.poisson.
  All distribution in the mixture of the same type and parametrized
  by the outcome of the mixing distribution and have to be a continuous
  distribution (or have a pdf method).
  As an example, a mixture of normal distributed random variables with
  Poisson as the mixing distribution.
  
  
  assumes vectorized shape, loc and scale as in scipy.stats.distributions
  
  assume mixing_dist is frozen
  
  initialization looks fragile for all possible cases of lower and upper
  bounds of the distributions.
docstr: create a mixture distribution
  
  Parameters
  ----------
  mixing_dist : discrete frozen distribution
      mixing distribution
  base_dist : continuous distribution
      parametrized distributions in the mixture
  bd_args_func : callable
      function that builds the tuple of args for the base_dist.
      The function obtains as argument the values in the support of
      the mixing distribution and should return an empty tuple or
      a tuple of arrays.
  bd_kwds_func : callable
      function that builds the dictionary of kwds for the base_dist.
      The function obtains as argument the values in the support of
      the mixing distribution and should return an empty dictionary or
      a dictionary with arrays as values.
  cutoff : float
      If the mixing distribution has infinite support, then the
      distribution is truncated with approximately (subject to integer
      conversion) the cutoff probability in the missing tail. Random
      draws that are outside the truncated range are clipped, that is
      assigned to the highest or lowest value in the truncated support.
docstr_tok: ["create","a","mixture","distribution","Parameters","--","--","--","--","--","mixing_dist",":","discrete","frozen","distribution","mixing","distribution","base_dist",":","continuous","distribution","parametrized","distributions","in","the","mixture","bd_args_func",":","callable","function","that","builds","the","tuple","of","args","for","the","base_dist",".","The","function","obtains","as","argument","the","values","in","the","support","of","the","mixing","distribution","and","should","return","an","empty","tuple","or","a","tuple","of","arrays",".","bd_kwds_func",":","callable","function","that","builds","the","dictionary","of","kwds","for","the","base_dist",".","The","function","obtains","as","argument","the","values","in","the","support","of","the","mixing","distribution","and","should","return","an","empty","dictionary","or","a","dictionary","with","arrays","as","values",".","cutoff",":","float","If","the","mixing","distribution","has","infinite","support",",","then","the","distribution","is","truncated","with","approximately","(","subject","to","integer","conversion",")","the","cutoff","probability","in","the","missing","tail",".","Random","draws","that","are","outside","the","truncated","range","are","clipped",",","that","is","assigned","to","the","highest","or","lowest","value","in","the","truncated","support","."]
code: def __init__(
      self,
      mixing_dist,
      base_dist,
      bd_args_func,
      bd_kwds_func,
      cutoff=1e-3,
  ):
      """create a mixture distribution
  
      Parameters
      ----------
      mixing_dist : discrete frozen distribution
          mixing distribution
      base_dist : continuous distribution
          parametrized distributions in the mixture
      bd_args_func : callable
          function that builds the tuple of args for the base_dist.
          The function obtains as argument the values in the support of
          the mixing distribution and should return an empty tuple or
          a tuple of arrays.
      bd_kwds_func : callable
          function that builds the dictionary of kwds for the base_dist.
          The function obtains as argument the values in the support of
          the mixing distribution and should return an empty dictionary or
          a dictionary with arrays as values.
      cutoff : float
          If the mixing distribution has infinite support, then the
          distribution is truncated with approximately (subject to integer
          conversion) the cutoff probability in the missing tail. Random
          draws that are outside the truncated range are clipped, that is
          assigned to the highest or lowest value in the truncated support.
  
      """
      self.mixing_dist = mixing_dist
      self.base_dist = base_dist
      # self.bd_args = bd_args
      if not np.isneginf(mixing_dist.dist.a):
          lower = mixing_dist.dist.a
      else:
          lower = mixing_dist.ppf(1e-4)
      if not np.isposinf(mixing_dist.dist.b):
          upper = mixing_dist.dist.b
      else:
          upper = mixing_dist.isf(1e-4)
      self.ma = lower
      self.mb = upper
      mixing_support = np.arange(lower, upper + 1)
      self.mixing_probs = mixing_dist.pmf(mixing_support)
  
      self.bd_args = bd_args_func(mixing_support)
      self.bd_kwds = bd_kwds_func(mixing_support)
  
file_path: statsmodels/statsmodels/sandbox/distributions/otherdist.py
imports: import numpy
  from scipy import stats
label_desc: Use image node_id 1 to create a new ParametricMixtureD object  with example: obj = ParametricMixtureD(mixing_dist, base_dist, bd_args_func, bd_kwds_func, cutoff)