KLdist.matrix: Discrete version of Kullback-Leibler Distance (KLD)

KLdist.matriXR Documentation

Discrete version of Kullback-Leibler Distance (KLD)

Description

Calculate the KLD by binning continuous data.

KL distance is calculated using the formula

KLD(f_1(x),f_2(x)) = \sum_{i=1}^N{ f_1(x_i)*\log\frac{f_1(x_i)}{f_2(x_i)}}

Usage

KLdist.matrix(x, ...)

Arguments

x

n by p matrix or a list or an object of a class that extends eSet. If x is an object of a class derived from eSet (ExpressionSet,SnpSet etc), then the values returned by the exprs function are used.

...

arguments passed to KLdist.matrix:

gridsize

the number of grid points used to select the optimal bin width of the histogram used to estimate density. If no value is supplied, the grid size is calculated internally; default is NULL.

symmetrize

if TRUE, then symmetrize; the default is FALSE.

diag

if TRUE, then the diagonal of the distance matrix will be displayed; the default is FALSE.

upper

if TRUE, then the upper triangle of the distance matrix will be displayed; default is FALSE.

sample

for eSet methods: if TRUE, then the distances are computed between samples, otherwise, between features; the default is TRUE.

Details

The data are binned, and then the KL distance between the two discrete distributions is computed and used. The distance is computed between rows of the input matrix (except if the input is an object of a class that extends eSet and sample is TRUE.

The presumption is that all samples have the same number of observations. The list method is meant for use when samples sizes are unequal.

Value

An object of class dist is returned.

Author(s)

Beiying Ding

See Also

cor.dist, spearman.dist, tau.dist,euc, man,KLD.matrix,mutualInfo

Examples

 x <- matrix(rnorm(100), nrow = 5)
 KLdist.matrix(x, symmetrize = TRUE) 

Bioconductor/bioDist documentation built on Oct. 29, 2023, 5:04 p.m.