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: Copula correlation parameter using Kendall's tau of sample data.
  
  Parameters
  ----------
  data : array_like
      Sample data used to fit `theta` using Kendall's tau.
  
  Returns
  -------
  corr_param : float
      Correlation parameter of the copula, ``theta`` in Archimedean and
      pearson correlation in elliptical.
      If k_dim > 2, then average tau is used.
docstr_tok: ["Copula","correlation","parameter","using","Kendall","'s","tau","of","sample","data",".","Parameters","--","--","--","--","--","data",":","array_like","Sample","data","used","to","fit","`","theta","`","using","Kendall","'s","tau",".","Returns","--","--","--","-","corr_param",":","float","Correlation","parameter","of","the","copula",",","``","theta","``","in","Archimedean","and","pearson","correlation","in","elliptical",".","If","k_dim",">","2",",","then","average","tau","is","used","."]
code: def fit_corr_param(self, data):
      """Copula correlation parameter using Kendall's tau of sample data.
  
      Parameters
      ----------
      data : array_like
          Sample data used to fit `theta` using Kendall's tau.
  
      Returns
      -------
      corr_param : float
          Correlation parameter of the copula, ``theta`` in Archimedean and
          pearson correlation in elliptical.
          If k_dim > 2, then average tau is used.
      """
      x = np.asarray(data)
  
      if x.shape[1] == 2:
          tau = stats.kendalltau(x[:, 0], x[:, 1])[0]
      else:
          k = self.k_dim
          taus = [
              stats.kendalltau(x[..., i], x[..., j])[0]
              for i in range(k)
              for j in range(i + 1, k)
          ]
          tau = np.mean(taus)
      return self._arg_from_tau(tau)
  
imports: from abc import ABC, abstractmethod
  import numpy
  from scipy import stats
  from statsmodels.graphics import utils
label_desc: Use image node_id 9 for calling the Copula obj's underlying member method code with example usage: obj.fit_corr_param(data) and returns: self