Package elki.math.statistics.dependence
Class DCor
- java.lang.Object
-
- elki.math.statistics.dependence.DCor
-
- All Implemented Interfaces:
Dependence
@Reference(authors="G. J. Sz\u00e9kely, M. L. Rizzo, N. K. Bakirov", title="Measuring and testing dependence by correlation of distances", booktitle="The Annals of Statistics, 35(6), 2769-2794", url="https://doi.org/10.1214/009053607000000505", bibkey="doi:10.1214/009053607000000505") @Priority(200) public class DCor extends java.lang.Object implements Dependence
Distance correlation.The value returned is the square root of the dCor² value. This matches the R implementation by the original authors.
Reference:
G. J. Székely, M. L. Rizzo, N. K. Bakirov
Measuring and testing dependence by correlation of distances
The Annals of Statistics, 35(6), 2769-2794Implementation notice: we exploit symmetry, and thus use diagonal matrixes. While initially the diagonal is zero, after double-centering the matrix these values can become non-zero!
- Since:
- 0.7.0
- Author:
- Marie Kiermeier, Erich Schubert
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDCor.ParParameterization class-
Nested classes/interfaces inherited from interface elki.math.statistics.dependence.Dependence
Dependence.Utils
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected doublecomputeDCovar(double[] dVarMatrixA, double[] dVarMatrixB, int n)Computes the distance covariance for two axis.protected static <A> double[]computeDistances(NumberArrayAdapter<?,A> adapter, A data)Compute the double-centered delta matrix.<A,B>
doubledependence(NumberArrayAdapter<?,A> adapter1, A data1, NumberArrayAdapter<?,B> adapter2, B data2)Measure the dependence of two variables.<A> double[]dependence(NumberArrayAdapter<?,A> adapter, java.util.List<? extends A> data)Measure the dependence of two variables.static double[]doubleCenterMatrix(double[] dMatrix, int size)Computes the distance variance matrix of one axis.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface elki.math.statistics.dependence.Dependence
dependence, dependence
-
-
-
-
Field Detail
-
STATIC
public static final DCor STATIC
Static instance.
-
-
Constructor Detail
-
DCor
protected DCor()
Constructor - useSTATICinstance instead!
-
-
Method Detail
-
dependence
public <A,B> double dependence(NumberArrayAdapter<?,A> adapter1, A data1, NumberArrayAdapter<?,B> adapter2, B data2)
Description copied from interface:DependenceMeasure the dependence of two variables.This is the more flexible API, which allows using different internal data representations.
- Specified by:
dependencein interfaceDependence- Type Parameters:
A- First array typeB- Second array type- Parameters:
adapter1- First data adapterdata1- First data setadapter2- Second data adapterdata2- Second data set- Returns:
- Dependence measure
-
dependence
public <A> double[] dependence(NumberArrayAdapter<?,A> adapter, java.util.List<? extends A> data)
Description copied from interface:DependenceMeasure the dependence of two variables.This is the more flexible API, which allows using different internal data representations.
The resulting data is a serialized lower triangular matrix:
X S S S S S 0 X S S S S 1 2 X S S S 3 4 5 X S S 6 7 8 9 X S 10 11 12 13 14 X
- Specified by:
dependencein interfaceDependence- Type Parameters:
A- Array type- Parameters:
adapter- Data adapterdata- Data sets. Must have fast random access!- Returns:
- Lower triangular serialized matrix
-
computeDistances
protected static <A> double[] computeDistances(NumberArrayAdapter<?,A> adapter, A data)
Compute the double-centered delta matrix.- Parameters:
adapter- Data adapterdata- Input data- Returns:
- Double-centered delta matrix.
-
doubleCenterMatrix
public static double[] doubleCenterMatrix(double[] dMatrix, int size)Computes the distance variance matrix of one axis.- Parameters:
dMatrix- distance matrix of the axissize- Dimensionality- Returns:
- dMatrix
-
computeDCovar
protected double computeDCovar(double[] dVarMatrixA, double[] dVarMatrixB, int n)Computes the distance covariance for two axis. Can also be used to compute the distance variance of one axis (dVarMatrixA = dVarMatrixB).- Parameters:
dVarMatrixA- distance variance matrix of the first axisdVarMatrixB- distance variance matrix of the second axisn- number of points- Returns:
- distance covariance
-
-