class_docstr: A generic Copula class meant for subclassing.
  
  Notes
  -----
  A function :math:`\phi` on :math:`[0, \infty]` is the Laplace-Stieltjes
  transform of a distribution function if and only if :math:`\phi` is
  completely monotone and :math:`\phi(0) = 1` [2]_.
  
  The following algorithm for sampling a ``d``-dimensional exchangeable
  Archimedean copula with generator :math:`\phi` is due to Marshall, Olkin
  (1988) [1]_, where :math:`LS^{−1}(\phi)` denotes the inverse
  Laplace-Stieltjes transform of :math:`\phi`.
  
  From a mixture representation with respect to :math:`F`, the following
  algorithm may be derived for sampling Archimedean copulas, see [1]_.
  
  1. Sample :math:`V \sim F = LS^{−1}(\phi)`.
  2. Sample i.i.d. :math:`X_i \sim U[0,1], i \in \{1,...,d\}`.
  3. Return:math:`(U_1,..., U_d)`, where :math:`U_i = \phi(−\log(X_i)/V), i
     \in \{1, ...,d\}`.
  
  Detailed properties of each copula can be found in [3]_.
  
  Instances of the class can access the attributes: ``rng`` for the random
  number generator (used for the ``seed``).
  
  **Subclassing**
  
  When subclassing `Copula` to create a new copula, ``__init__`` and
  ``random`` must be redefined.
  
  * ``__init__(theta)``: If the copula
    does not take advantage of a ``theta``, this parameter can be omitted.
  * ``random(n, random_state)``: draw ``n`` from the copula.
  * ``pdf(x)``: PDF from the copula.
  * ``cdf(x)``: CDF from the copula.
  
  References
  ----------
  .. [1] Marshall AW, Olkin I. “Families of Multivariate Distributions”,
    Journal of the American Statistical Association, 83, 834–841, 1988.
  .. [2] Marius Hofert. "Sampling Archimedean copulas",
    Universität Ulm, 2008.
  .. rvs[3] Harry Joe. "Dependence Modeling with Copulas", Monographs on
    Statistics and Applied Probability 134, 2015.
class_docstr_tok: ["A","generic","Copula","class","meant","for","subclassing",".","Notes","--","--","-","A","function",":","math",":","`","\\phi","`","on",":","math",":","`","[","0",",","\\infty","]","`","is","the","Laplace-Stieltjes","transform","of","a","distribution","function","if","and","only","if",":","math",":","`","\\phi","`","is","completely","monotone","and",":","math",":","`","\\phi","(","0",")","=","1","`","[","2","]","_",".","The","following","algorithm","for","sampling","a","``","d","``","-dimensional","exchangeable","Archimedean","copula","with","generator",":","math",":","`","\\phi","`","is","due","to","Marshall",",","Olkin","(","1988",")","[","1","]","_",",","where",":","math",":","`","LS^","{","\u22121","}","(","\\phi",")","`","denotes","the","inverse","Laplace-Stieltjes","transform","of",":","math",":","`","\\phi","`",".","From","a","mixture","representation","with","respect","to",":","math",":","`","F","`",",","the","following","algorithm","may","be","derived","for","sampling","Archimedean","copulas",",","see","[","1","]","_",".","1",".","Sample",":","math",":","`","V","\\sim","F","=","LS^","{","\u22121","}","(","\\phi",")","`",".","2",".","Sample","i.i.d",".",":","math",":","`","X_i","\\sim","U","[","0,1","]",",","i","\\in","\\","{","1",",","...",",","d\\","}","`",".","3",".","Return",":","math",":","`","(","U_1",",","...",",","U_d",")","`",",","where",":","math",":","`","U_i","=","\\phi","(","\u2212\\log","(","X_i",")","\/V",")",",","i","\\in","\\","{","1",",","...",",","d\\","}","`",".","Detailed","properties","of","each","copula","can","be","found","in","[","3","]","_",".","Instances","of","the","class","can","access","the","attributes",":","``","rng","``","for","the","random","number","generator","(","used","for","the","``","seed","``",")",".","*","*","Subclassing","*","*","When","subclassing","`","Copula","`","to","create","a","new","copula",",","``","__init__","``","and","``","random","``","must","be","redefined",".","*","``","__init__","(","theta",")","``",":","If","the","copula","does","not","take","advantage","of","a","``","theta","``",",","this","parameter","can","be","omitted",".","*","``","random","(","n",",","random_state",")","``",":","draw","``","n","``","from","the","copula",".","*","``","pdf","(","x",")","``",":","PDF","from","the","copula",".","*","``","cdf","(","x",")","``",":","CDF","from","the","copula",".","References","--","--","--","--","--","..","[","1","]","Marshall","AW",",","Olkin","I",".","\u201c","Families","of","Multivariate","Distributions","\u201d",",","Journal","of","the","American","Statistical","Association",",","83",",","834\u2013841",",","1988",".","..","[","2","]","Marius","Hofert",".","``","Sampling","Archimedean","copulas","''",",","Universit\u00e4t","Ulm",",","2008",".","..","rvs","[","3","]","Harry","Joe",".","``","Dependence","Modeling","with","Copulas","''",",","Monographs","on","Statistics","and","Applied","Probability","134",",","2015","."]
docstr: Sample the copula and plot.
  
  Parameters
  ----------
  sample : array-like, optional
      The sample to plot.  If not provided (the default), a sample
      is generated.
  nobs : int, optional
      Number of samples to generate from the copula.
  random_state : {None, int, numpy.random.Generator}, optional
      If `seed` is None then the legacy singleton NumPy generator.
      This will change after 0.13 to use a fresh NumPy ``Generator``,
      so you should explicitly pass a seeded ``Generator`` if you
      need reproducible results.
      If `seed` is an int, a new ``Generator`` instance is used,
      seeded with `seed`.
      If `seed` is already a ``Generator`` instance then that instance is
      used.
  ax : AxesSubplot, optional
      If given, this subplot is used to plot in instead of a new figure
      being created.
  
  Returns
  -------
  fig : Figure
      If `ax` is None, the created figure.  Otherwise the figure to which
      `ax` is connected.
  sample : array_like (n, d)
      Sample from the copula.
  
  See Also
  --------
  statsmodels.tools.rng_qrng.check_random_state
docstr_tok: ["Sample","the","copula","and","plot",".","Parameters","--","--","--","--","--","sample",":","array-like",",","optional","The","sample","to","plot",".","If","not","provided","(","the","default",")",",","a","sample","is","generated",".","nobs",":","int",",","optional","Number","of","samples","to","generate","from","the","copula",".","random_state",":","{","None",",","int",",","numpy.random.Generator","}",",","optional","If","`","seed","`","is","None","then","the","legacy","singleton","NumPy","generator",".","This","will","change","after","0.13","to","use","a","fresh","NumPy","``","Generator","``",",","so","you","should","explicitly","pass","a","seeded","``","Generator","``","if","you","need","reproducible","results",".","If","`","seed","`","is","an","int",",","a","new","``","Generator","``","instance","is","used",",","seeded","with","`","seed","`",".","If","`","seed","`","is","already","a","``","Generator","``","instance","then","that","instance","is","used",".","ax",":","AxesSubplot",",","optional","If","given",",","this","subplot","is","used","to","plot","in","instead","of","a","new","figure","being","created",".","Returns","--","--","--","-","fig",":","Figure","If","`","ax","`","is","None",",","the","created","figure",".","Otherwise","the","figure","to","which","`","ax","`","is","connected",".","sample",":","array_like","(","n",",","d",")","Sample","from","the","copula",".","See","Also","--","--","--","--","statsmodels.tools.rng_qrng.check_random_state"]
code: def plot_scatter(
      self, sample=None, nobs=500, random_state=None, ax=None
  ):
      """Sample the copula and plot.
  
      Parameters
      ----------
      sample : array-like, optional
          The sample to plot.  If not provided (the default), a sample
          is generated.
      nobs : int, optional
          Number of samples to generate from the copula.
      random_state : {None, int, numpy.random.Generator}, optional
          If `seed` is None then the legacy singleton NumPy generator.
          This will change after 0.13 to use a fresh NumPy ``Generator``,
          so you should explicitly pass a seeded ``Generator`` if you
          need reproducible results.
          If `seed` is an int, a new ``Generator`` instance is used,
          seeded with `seed`.
          If `seed` is already a ``Generator`` instance then that instance is
          used.
      ax : AxesSubplot, optional
          If given, this subplot is used to plot in instead of a new figure
          being created.
  
      Returns
      -------
      fig : Figure
          If `ax` is None, the created figure.  Otherwise the figure to which
          `ax` is connected.
      sample : array_like (n, d)
          Sample from the copula.
  
      See Also
      --------
      statsmodels.tools.rng_qrng.check_random_state
      """
      if self.k_dim != 2:
          raise ValueError("Can only plot 2-dimensional Copula.")
  
      if sample is None:
          sample = self.rvs(nobs=nobs, random_state=random_state)
  
      fig, ax = utils.create_mpl_ax(ax)
      ax.scatter(sample[:, 0], sample[:, 1])
      ax.set_xlabel("u")
      ax.set_ylabel("v")
  
      return fig, sample
  
imports: from abc import ABC, abstractmethod
  import numpy
  from scipy import stats
  from statsmodels.graphics import utils
label_desc: Use image node_id 6 for calling the Copula obj's underlying member method code with example usage: obj.plot_scatter(sample, nobs, random_state, ax) and returns: fig,  sample