IMSL C# Numerical Library

Dissimilarities Class

Computes a matrix of dissimilarities (or similarities) between the columns (or rows) of a matrix.

For a list of all members of this type, see Dissimilarities Members.

System.Object
   Imsl.Stat.Dissimilarities

public class Dissimilarities

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

Class Dissimilarities computes an upper triangular matrix (excluding the diagonal) of dissimilarities (or similarities) between the columns or rows of a matrix. Nine different distance measures can be computed. For the first three measures, three different scaling options can be employed. The distance matrix computed is generally used as input to clustering or multidimensional scaling functions.

The following discussion assumes that the distance measure is being computed between the columns of the matrix. If distances between the rows of the matrix are desired, set iRow to 1 when calling the Dissimilarities constructor.

For distanceMethod = 0 to 2, each row of x is first scaled according to the value of distanceScale. The scaling parameters are obtained from the values in the row scaled as either the standard deviation of the row or the row range; the standard deviation is computed from the unbiased estimate of the variance. If distanceScale is 0, no scaling is performed, and the parameters in the following discussion are all 1.0. Once the scaling value (if any) has been computed, the distance between column i and column j is computed via the difference vector z_k=\frac{(x_k-y_k)}{s_k},i=1,\ldots,ndstm, where x_k denotes the k-th element in the i-th column, y_k denotes the corresponding element in the j-th column, and ndstm is the number of rows if differencing columns and the number of columns if differencing rows. For given z_i, the metrics 0 to 2 are defined as:

distanceMethodMetric
0Euclidean distance (L_2 norm)
1Sum of the absolute differences (L_1 norm)
2Maximum difference (L_\infty norm)

Distance measures corresponding to distanceMethod = 3 to 8 do not allow for scaling.

distanceMethodMetric
3Mahalanobis distance
4Absolute value of the cosine of the angle between the vectors
5Angle in radians (0, pi) between the lines through the origin defined by the vectors
6Correlation coefficient
7Absolute value of the correlation coefficient
8Number of exact matches, where x_i = y_i.

For the Mahalanobis distance, any variable used in computing the distance measure that is (numerically) linearly dependent upon the previous variables in the indexArray vector is omitted from the distance measure.

Requirements

Namespace: Imsl.Stat

Assembly: ImslCS (in ImslCS.dll)

See Also

Dissimilarities Members | Imsl.Stat Namespace | Example 1 | Example 2