Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/clusterDistances.R

Calculate a matrix storing the dissimilarities between each pair of clusters (meta-clusters) across a pair of samples (templates) `S1`

and `S2`

. `(i,j)th`

entry of the matrix stores dissimilarity between `i-th`

cluster (meta-cluster) from `S1`

and the `j-th`

cluster (meta-cluster) from `S2`

.

1 | ```
dist.matrix(object1,object2, dist.type = 'Mahalanobis')
``` |

`object1 ` |
an object of class |

`object2 ` |
an object of class |

`dist.type` |
character, indicating the method with which the dissimilarity between a pair of clusters (meta-clusters) is computed. Supported dissimilarity measures are: 'Mahalanobis', 'KL' and 'Euclidean', with the default is set to 'Mahalanobis' distance. |

Consider two FC samples/templates `S1`

and `S2`

with `k1`

and `k2`

clusters/meta-clusters. The dissimilarity between each pair of cluster (meta-clusters) across `S1`

and `S2`

is computed and stored in a (`k1 x k2`

) matrix. The dissimilarity between `i-th`

cluster (meta-cluster) from `S1`

and `j-th`

cluster (meta-cluster) from `S2`

is computed using function `dist.cluster`

.

`dist.matrix`

function returns a (`k1 x k2`

) matrix where `k1`

and `k2`

are the number of clusters (meta-clusters) in the first and the second samples (templates) respectively. `(i,j)`

th entry of the matrix contains the dissimilarity between the `i-th`

cluster (meta-cluster) from sample1 (template1) and the `j-th`

cluster (meta-cluster) from sample2 (template2).

Ariful Azad

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | ```
## ------------------------------------------------
## load data and retrieve two samples
## ------------------------------------------------
library(healthyFlowData)
data(hd)
sample1 = exprs(hd.flowSet[[1]])
sample2 = exprs(hd.flowSet[[2]])
## ------------------------------------------------
## cluster sample using kmeans algorithm
## ------------------------------------------------
clust1 = kmeans(sample1, centers=4, nstart=20)
clust2 = kmeans(sample2, centers=4, nstart=20)
cluster.labels1 = clust1$cluster
cluster.labels2 = clust2$cluster
## ------------------------------------------------
## Create ClusteredSample object
## and compute the Mahalanobis distance between
## each pair of clsuters and save it in a matrix
## ------------------------------------------------
clustSample1 = ClusteredSample(labels=cluster.labels1, sample=sample1)
clustSample2 = ClusteredSample(labels=cluster.labels2, sample=sample2)
## compute the dissimilarity matrix
DM = dist.matrix(clustSample1, clustSample2, dist.type='Mahalanobis')
print(DM)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.