Gower's distance
In statistics, Gower's distance between two mixed-type objects is a similarity measure that can handle different types of data within the same dataset and is particularly useful in cluster analysis or other multivariate statistical techniques. Data can be binary, ordinal, or continuous variables. It works by normalizing the differences between each pair of variables and then computing a weighted average of these differences. The distance was defined in 1971 by Gower[1] and it takes values between 0 and 1 with smaller values indicating higher similarity.
Definition
[edit]For two objects and having descriptors, the similarity is defined as:
where the are non-negative weights usually set to [2] and is the similarity between the two objects regarding their -th variable. If the variable is binary or ordinal, the values of are 0 or 1, with 1 denoting equality. If the variable is continuous, with being the range of -th variable and thus ensuring . As a result, the overall similarity between two objects is the weighted average of the similarities calculated for all their descriptors.[3]
In its original exposition, the distance does not treat ordinal variables in a special manner. In the 1990s, first Kaufman and Rousseeuw[4] and later Podani[5] suggested extensions where the ordering of an ordinal feature is used. For example, Podani obtains relative rank differences as with being the ranks corresponding to the ordered categories of the -th variable.
Software implementations
[edit]Many programming languages and statistical packages, such as R, Python, etc., include implementations of Gower's distance. The implementations may follow Kaufmann and Rousseeuw's extensions, which change the similarity for continuous variables to [6]
Language/program | Function | Ref. |
---|---|---|
R | StatMatch::gower.dist(X) |
[1] |
Python | gower.gower_matrix(X) |
[2] |
References
[edit]- ^ Gower, John C (1971). "A general coefficient of similarity and some of its properties". Biometrics. 27 (4): 857–871. doi:10.2307/2528823. JSTOR 2528823. Retrieved 2024-06-03.
- ^ Borg, Ingwer; Groenen, Patrick J. F. (2005). Modern multidimensional scaling: theory and applications (2 ed.). New York [Heidelberg]: Springer. pp. 124–125. ISBN 978-0387-25150-9.
- ^ Legendre, Pierre; Legendre, Louis (2012). Numerical ecology (Third English ed.). Amsterdam: Elsevier. pp. 278–280. ISBN 978-0-444-53868-0.
- ^ Kaufman, Leonard; Rousseeuw, Peter J. (1990). Finding groups in data: an introduction to cluster analysis. New York: Wiley. pp. 35–36. ISBN 9780471878766.
- ^ Podani, János (May 1999). "Extending Gower's general coefficient of similarity to ordinal characters". Taxon. 48 (2): 331–340. doi:10.2307/1224438. JSTOR 1224438.
- ^ D'Orazio, Marcello. "gower.dist {StatMatch}". The R Project for Statistical Computing. Retrieved 31 October 2024.