Question: Calculate Correlation Based On Distance

0

ancient_learner •

**630**wrote:Hi I have a set of regulatory factors separated by distance in a matrix form as follows

```
A B C D
A|0|1|2|9
B|1|0|3|6
C|2|5|0|1
D|3|5|1|0
```

I want to identify the correlation based on their distances (values in matrix represent the distances). i,e., if the distance between the pair is more we expect the correlation to be little lower than the pair with less distance. How to do this

That is not possible, given how correlation is calculated. Calculate correlation based on original values. Also, if the distance is edit distance of sequences, then you cannot calculate correlation at all.

47kthen how about the clustering? i want to group them based on the distance

630Yes, you can do that with a distance matrix, at least for hierarchical clustering, see

`?hclust`

. Other methods, which require the original data, like k-means are not aplicable.47k