# Which (dis)similarity index to choose for cluster analysis?

I have data that refer to the number of occurrences of specific variable in samples:

       V1  V2  V3 ...
sample1 0   2   1
sample2 7   1   0
sample3 1   4   1
....


The data refers to the occurrence of genes(V1...) in different genomes (sample1..).

I want to perform a cluster analysis combined with an heat map. I used the function heatmap.2 in the gplot package in R. I used Euclidian distances for calculating the distance among the samples. The clustering algorithm is the default one for the function hclust in R (hclust(d, method = "complete", members = NULL)). However, I am not completely sure it is the right method. Any suggestion on how to choose the right method to calculate the distances among my samples?

EDIT The aim is to describe the distribution of the variables (genes) among the samples (genome), and cluster the samples(genomes) according with the values that each variables assume (meaning, how many specific genes are present)

• You need to describe your variables and state which clustering method you're using. Choice of distance or dissimilarity index tends to be application-specific. May 4, 2015 at 18:27
• @ssdecontrol Thanks for your comment. Please, see my edit. May 4, 2015 at 18:32
• Great, I don't have time to add an answer right now but the question is now much more answerable than before, not to mention more helpful to future readers May 4, 2015 at 18:33
• Also, some info that might help you here, here, and maybe here May 4, 2015 at 18:34
• Might you be looking for something like this: immunityageing.com/content/5/1/5/figure/F2?highres=y May 15, 2015 at 13:24

## 1 Answer

How to choose? the right method?

There may be no single right method. If there is, it's whatever best represents similarity /dissimilarity in the domain. Does the euclidian distance actually reflect a biologically meaningful measure of how similar or different these genomes are? I'm no biologist, but perhaps you should compare how many genes are in common... maybe how many are in common out of the total? a jaccard coefficient perhaps?

If none stands out, try two or three and see if they give very different results. If they give the same results, then it's not important which one you use. If they give radically different results then you should worry about it, because it's really important, and figure it out with respect to genetics, not stats/machine learning. If you get pretty much the same results with a few differences, then you should draw conclusions primarily from the results that are consistent across different similarity/distance metrics, and be more cautious about the others.

• Thanks for your answer. Using Jaccard and Euclidian I get different clustering. Do you know any reference I could read to understand when is better to use one and when to use the other? May 5, 2015 at 9:52
• Sorry, I don't. I could google it, but you can just as well. Also, I think it's an issue that a biologist should answer. Take a sample, and run it through a few experts (you included, perhaps) and let them decide following their intuition, which data points they think are similar. Then take their expert decisions and see which distance metric they match best. The purpose of clustering is to do automatically and on a large scale what a human could only do on a small scale. But on a sample, both should match. May 7, 2015 at 14:14