Learn R Programming

ICGE (version 0.3)

dbhatta: Bhattacharyya Distance

Description

dbhatta computes and returns the Bhattacharyya distance matrix between the rows of a data matrix. This distance is defined between two units \(i=(p_{i1},...,p_{im})\) and \(j=(p_{j1},...,p_{jm})\) being \(p_{kl}\) frequencies with \(p_{kl}>=0\) and \(p_{k1}+...+p_{km}=1\).

Usage

dbhatta(x)

Arguments

x

a matrix containing, in its rows, the frequencies for each unit.

Value

A dist object with distance information.

References

Bhattacharyya, A. (1946). On a measure of divergence of two multinomial populations. Sankhya: The Indian Journal of Statistics, Series A. 14, 177-136.

See Also

dist, dmahal, dgower, dcor, dproc2

Examples

Run this code
# NOT RUN {
#Generate 10 objects in dimension 4. Number of trials M=30. 
#Frequencies obtained using tabulate function.
n <- 10
f <- matrix(0, n, 4)
M <- 30
for (i in 1:n){
    f[i,] <- tabulate(sample(1:4, M, replace=TRUE))/M
}


# Bhattacharyya distances between pairs 
d <- dbhatta(f)
# }

Run the code above in your browser using DataLab