dot-calc.hoeffding: Compute Hoeffding's D statistic

Description Usage Arguments Details Value Examples

Description

This is an internal CPP function, used by the R function hoeffding.D.test.

Usage

1

Arguments

perm

An integer vector containing exactly 0,1,...,n-1 in any order.

The validity of the input is not checked by this function.

Details

Given (X1,Y1),...,(Xn,Yn), Hoeffding's Dn only depends on the permutation P that satisfies rank Yi = P[rank Xi]. This function computes Dn given P in O(n log n) time.

Value

Hoeffding's D statistic of perm.

The normalization is such that -1/60 <= D <= 1/30.

The return value -1.0 indicates an error.

Examples

1
2
3
4
5
6
7
8
9
.calc.hoeffding(0:4)
## [1] 0.03333333

.calc.hoeffding(c(0,3,2,1,4))
## [1] -0.01666667

set.seed(397)
.calc.hoeffding(order(runif(1000))-1) * 36
## [1] 0.004349087

independence documentation built on Jan. 14, 2021, 5:20 a.m.