cltoSim {mcclust} | R Documentation |
Compute Similarity Matrix for a Clustering and vice versa
Description
A similarity matrix is a symmetric matrix whose entry [i,j]
is 1 if observation i
and j
are in the same cluster and 0 otherwise.
Usage
cltoSim(cl)
Simtocl(Sim)
Arguments
cl |
vector of cluster memberships |
Sim |
similarity matrix |
Warning
Simtocl
does not check whether Sim
is a valid similarity matrix,
e.g. that Sim[i,j]==1
if Sim[i,k]==1
and Sim[j,k]==1.
Author(s)
Arno Fritsch, arno.fritsch@tu-dortmund.de
See Also
comp.psm
for an average similarity matrix.
Examples
cl <- c(3,3,1,2,2)
(Sim <- cltoSim(cl))
Simtocl(Sim)
# not a valid similarity matrix
(Sim2 <- matrix(c(1,0,1,0,1,1,1,1,1), ncol=3))
Simtocl(Sim2) # no warning
[Package mcclust version 1.0.1 Index]