nHSIC: Normalized Hilbert-Schmidt Independence Criterion

View source: R/nHSIC.R

nHSICR Documentation

Normalized Hilbert-Schmidt Independence Criterion

Description

Computes a normalized version of the Hilbert-Schmidt Independence Criterion (HSIC) between two random vectors.

Usage

nHSIC(x, y)

Arguments

x

A numeric vector or numeric matrix. Rows correspond to observations.

y

A numeric vector or numeric matrix. Rows correspond to observations.

Details

The normalization rescales HSIC to reduce the influence of marginal scale effects and yields a quantity analogous in spirit to a correlation measure.

The normalized HSIC is defined as

\mathrm{nHSIC}(X,Y) = \sqrt{ \frac{\mathrm{HSIC}(X,Y)} {\sqrt{\mathrm{HSIC}(X,X)\mathrm{HSIC}(Y,Y)}} }.

Here, \mathrm{HSIC}(X,Y) denotes the empirical HSIC value computed using dhsic.

Vectors are treated as one-column matrices.

The function computes empirical HSIC values for (x, y), (x, x), and (y, y) and combines them according to the normalization formula above.

If the normalization denominator is numerically non-positive, the function returns 0.

Small negative values caused by floating-point arithmetic are truncated to zero before taking the square root.

Value

A numeric scalar giving the normalized HSIC value.

References

Gretton, A., Bousquet, O., Smola, A., and Schölkopf, B. (2005). Measuring statistical dependence with Hilbert-Schmidt norms. Algorithmic Learning Theory, 63–77. doi:10.1007/11564089_7.

Examples

set.seed(1)

n <- 200

x <- matrix(rnorm(n), ncol = 1)
y <- x^2 + 0.3 * rnorm(n)

# Standard HSIC
dHSIC::dhsic(x, y)$dHSIC

# Normalized HSIC
nHSIC(x, y)

# Independent variables
z <- matrix(rnorm(n), ncol = 1)

dHSIC::dhsic(x, z)$dHSIC
nHSIC(x, z)


dcorBSS documentation built on Nov. 10, 2026, 5:07 p.m.