Last data update: 2014.03.03

R: Bhattacharyya Distance
dbhattaR Documentation

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.

Author(s)

Itziar Irigoien itziar.irigoien@ehu.es; Konputazio Zientziak eta Adimen Artifiziala, Euskal Herriko Unibertsitatea (UPV-EHU), Donostia, Spain.

Conchita Arenas carenas@ub.edu; Departament d'Estadistica, Universitat de Barcelona, Barcelona, Spain.

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

#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)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(ICGE)
Loading required package: MASS
Loading required package: cluster
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/ICGE/dbhatta.Rd_%03d_medium.png", width=480, height=480)
> ### Name: dbhatta
> ### Title: Bhattacharyya Distance
> ### Aliases: dbhatta
> ### Keywords: multivariate
> 
> ### ** Examples
> 
> #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)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>