def estimation(self, y, ds=None):
""" Estimate the fourth multivariate extension of Spearman's rho.
Parameters
----------
y : (number of samples, dimension)-ndarray
One row of y corresponds to one sample.
ds : int vector, vector of ones
ds[i] = 1 (for all i): the i^th subspace is one-dimensional.
If ds is not given (ds=None), the vector of ones [ds =
ones(y.shape[1],dtype='int')] is emulated inside the function.
Returns
-------
a : float
Estimated fourth multivariate extension of Spearman's rho.
References
----------
Friedrich Shmid, Rafael Schmidt, Thomas Blumentritt, Sandra
Gaiser, and Martin Ruppert. Copula Theory and Its Applications,
Chapter Copula based Measures of Multivariate Association. Lecture
Notes in Statistics. Springer, 2010.
Friedrich Schmid and Rafael Schmidt. Multivariate extensions of
Spearman's rho and related statistics. Statistics & Probability
Letters, 77:407-416, 2007.
Maurice G. Kendall. Rank correlation methods. London, Griffin,
1970.
C. Spearman. The proof and measurement of association between two
things. The American Journal of Psychology, 15:72-101, 1904.
Examples
--------
a = co.estimation(y,ds)
"""
if ds is None: # emulate 'ds = vector of ones'
ds = ones(y.shape[1], dtype='int')
# verification:
self.verification_compatible_subspace_dimensions(y, ds)
self.verification_one_dimensional_subspaces(ds)
num_of_samples, dim = y.shape # number of samples, dimension
u = copula_transformation(y)
m_triu = triu(ones((dim, dim)), 1) # upper triangular mask
b = binom(dim, 2)
a = 12 * sum(dot((1 - u).T, (1 - u)) * m_triu) /\
(b * num_of_samples) - 3
return a
评论列表
文章目录