hellingerpar: Hellinger distance between Gaussian densities given their...

View source: R/hellingerpar.R

hellingerparR Documentation

Hellinger distance between Gaussian densities given their parameters

Description

Hellinger distance between two multivariate (p > 1) or univariate (p = 1) Gaussian densities given their parameters (mean vectors and covariance matrices if the densities are multivariate, or means and variances if univariate) (see Details).

Usage

hellingerpar(mean1, var1, mean2, var2, check = FALSE)

Arguments

mean1

p-length numeric vector: the mean of the first Gaussian density.

var1

p x p symmetric numeric matrix (p > 1) or numeric (p = 1): the covariance matrix (p > 1) or the variance (p = 1) of the first Gaussian density.

mean2

p-length numeric vector: the mean of the second Gaussian density.

var2

p x p symmetric numeric matrix (p > 1) or numeric (p = 1): the covariance matrix (p > 1) or the variance (p = 1) of the second Gaussian density.

check

logical. When TRUE (the default is FALSE) the function checks if the covariance matrices are not degenerate (multivariate case) or if the variances are not zero (univariate case).

Details

The mean vectors (m1 and m2) and variance matrices (v1 and v2) given as arguments (mean1, mean2, var1 and var2) are used to compute the Hellinger distance between the two Gaussian densities, equal to:

( 2 (1 - 2^{p/2} det(v1 v2)^{1/4} det(v1 + v2)^{-1/2} exp((-1/4) t(m1-m2) (v1+v2)^{-1} (m1-m2)) ))^{1/2}

If p = 1 the means and variances are numbers, the formula is the same ignoring the following operators: t (transpose of a matrix or vector) and det (determinant of a square matrix).

Value

The Hellinger distance between two Gaussian densities.

Be careful! If check = FALSE and one covariance matrix is degenerated (multivariate case) or one variance is zero (univariate case), the result returned must not be considered.

Author(s)

Rachid Boumaza, Pierre Santagostini, Smail Yousfi, Gilles Hunault, Sabine Demotes-Mainard

References

McLachlan, G.J. (1992). Discriminant analysis and statistical pattern recognition. John Wiley & Sons, New York .

See Also

hellinger: Hellinger distance between Gaussian densities estimated from samples.

Examples

m1 <- c(1,1)
v1 <- matrix(c(4,1,1,9),ncol = 2)
m2 <- c(0,1)
v2 <- matrix(c(1,0,0,1),ncol = 2)
hellingerpar(m1,v1,m2,v2)

dad documentation built on Aug. 30, 2023, 5:06 p.m.