## Class HoeffdingsD

• java.lang.Object
• elki.math.statistics.dependence.HoeffdingsD
• All Implemented Interfaces:
Dependence

@Reference(authors="W. Hoeffding",
title="A non-parametric test of independence",
booktitle="The Annals of Mathematical Statistics 19",
url="http://www.jstor.org/stable/2236021",
bibkey="journals/mathstat/Hoeffding48")
public class HoeffdingsD
extends java.lang.Object
implements Dependence
Calculate Hoeffding's D as a measure of dependence.

References:

W. Hoeffding:
A non-parametric test of independence
The Annals of Mathematical Statistics 19:546–57

The resulting value is scaled by 30, so it is in the range [-.5;1].

Since:
0.7.0
Author:
Yinchong Yang, Erich Schubert
• ### Nested Class Summary

Nested Classes
Modifier and Type Class Description
static class  HoeffdingsD.Par
Parameterization class.
• ### Nested classes/interfaces inherited from interface elki.math.statistics.dependence.Dependence

Dependence.Utils
• ### Field Summary

Fields
Modifier and Type Field Description
static HoeffdingsD STATIC
Static instance.
private static double[] TABPOS
private static double[] TABVAL
• ### Constructor Summary

Constructors
Modifier Constructor Description
protected  HoeffdingsD()
Constructor - use STATIC instance.
• ### Method Summary

All Methods
Modifier and Type Method Description
protected static <A,​B>double[] computeBivariateRanks​(NumberArrayAdapter<?,​A> adapter1, A data1, NumberArrayAdapter<?,​B> adapter2, B data2, int len)
Compute bivariate ranks.
<A,​B>double dependence​(NumberArrayAdapter<?,​A> adapter1, A data1, NumberArrayAdapter<?,​B> adapter2, B data2)
Measure the dependence of two variables.
double toPValue​(double d, int n)
Convert Hoeffding D value to a p-value.
• ### 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, dependence
• ### Field Detail

• #### STATIC

public static final HoeffdingsD STATIC
Static instance.
• #### TABVAL

private static final double[] TABVAL
• #### TABPOS

private static final double[] TABPOS
• ### Constructor Detail

• #### HoeffdingsD

protected HoeffdingsD()
Constructor - use STATIC instance.
• ### Method Detail

• #### dependence

public <A,​B> double dependence​(NumberArrayAdapter<?,​A> adapter1,
A data1,
B data2)
Description copied from interface: Dependence
Measure the dependence of two variables.

This is the more flexible API, which allows using different internal data representations.

Specified by:
dependence in interface Dependence
Type Parameters:
A - First array type
B - Second array type
Parameters:
adapter1 - First data adapter
data1 - First data set
adapter2 - Second data adapter
data2 - Second data set
Returns:
Dependence measure
• #### computeBivariateRanks

protected static <A,​B> double[] computeBivariateRanks​(NumberArrayAdapter<?,​A> adapter1,
A data1,
B data2,
int len)
Compute bivariate ranks.

q[i] is the number of objects such that x[j] < x[i] and y[j] < y[i]

Parameters:
adapter1 - First adapter
data1 - First data set
adapter2 - Second adapter
data2 - Second data set
len - Length
Returns:
Bivariate rank statistics.
• #### toPValue

public double toPValue​(double d,
int n)
Convert Hoeffding D value to a p-value.
Parameters:
d - D value
n - Data set size
Returns:
p-value