Energy distance between matrices | R Documentation |
Energy distance between matrices.
edist(x, y=NULL)
x |
A matrix with numbers or a list with matrices. |
y |
A second matrix with data. The number of columns of x and y must match. The number of rows can be different. |
This calculates the energy distance between two matrices. It will work even for tens of thousands of rows, it will just take some time. See the references for more information. If you have many matrices and want to calculate the distance matrix, then put them in a list and use the function.
If "x" is matrix, a numerical value, the energy distance. If "x" is list, a matrix with all pairwsie distances of the matrices.
Manos Papadakis
R implementation and documentation: Manos Papadakis <papadakm95@gmail.com>.
Szekely G. J. and Rizzo M. L. (2004) Testing for Equal Distributions in High Dimension, InterStat, November (5).
Szekely G. J. (2000) Technical Report 03-05, E-statistics: Energy of Statistical Samples, Department of Mathematics and Statistics, Bowling Green State University.
Sejdinovic D., Sriperumbudur B., Gretton A. and Fukumizu, K. (2013). Equivalence of distance-based and RKHS-based statistics in hypothesis testing. The Annals of Statistics, 41(5), 2263-2291.
dvar, total.dist, total.dista, Dist, dista
x <- as.matrix( iris[1:50, 1:4] )
y <- as.matrix( iris[51:100, 1:4] )
res<-edist(x, y)
z <- as.matrix(iris[101:150, 1:4])
a <- list()
a[[ 1 ]] <- x
a[[ 2 ]] <- y
a[[ 3 ]] <- z
res<-edist(a)
x<-y<-z<-a<-NULL
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.