Skip to main content
. Author manuscript; available in PMC: 2022 Jun 1.
Published in final edited form as: J Biomed Inform. 2021 Apr 20;118:103788. doi: 10.1016/j.jbi.2021.103788

Table 3.

Comparison of distance metrics.

Distance Data type Mathematical Expression Method
Euclidean Continuous d(i,j)=(|xi1xj1|2+|xi2xj2|2++|xipxjp|2)1/2
dBINARY=(b+c)2
Distance in real space
Manhattan Continuous d(i,j)=|xi1xj1|+|xi2xj2|++|xipxjp|
dBINARY=b+c
Distance in real space
Jaccard Index Asymmetric binary d=aa+b+c Negative match exclusive
Hamming Symmetric binary d=b+c Hamming-like
Gower Nominal, ordinal; binary, continuous1 s(i,j)=k=1nsijk/k=1nδijk
sijk;BINARY=aa+b+c
sijk;NOMINAL=1ifxik=xjk;sijk;NOMINAL=0ifxikxjk
sijk;QUANTITATIVE2=1|xikxjk|/rk
Simple matching
1

Although the Gower coefficient can be implemented for multiple data types, in this study it is implemented for only nominal and ordinal data.

2

“Quantitative” = ordinal or continuous.