Description Usage Arguments Details Value Author(s) See Also Examples
dist computes distances between pairs of elements: gdist takes two arguments, and returns the matrix of distances wrt every possible pair with one argument from each group. General Mahalanobis metrics are also allowed.
1 |
g1 |
n1 x d matrix with n1 data elements. |
g2 |
n2 x d matrix with n2 data elements. |
metric |
If NULL, defaults to identity (i.e. Euclidean distance). A d x d matrix is assumed as a sample covariance matrix, and its inverse is used to compute distances (i.e. Mahalanobis distance). Likewise, a list of n2 d x d matrices can be provided, yielding distances specific to each row in g2. |
norm |
If TRUE, a ln det term is added to distances in order to mitigate the prevalence of metrics reflecting large variance. |
This function is especially useful to make algorithms such as k-means (or mkmeans in the package) more efficient - rows in g1 are then generally the data set, and in g2 respectively cluster centres.
n1 x n2 matrix of distances
P. Bruneau
1 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.