powered by
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.
i
j
cltoSim(cl) Simtocl(Sim)
vector of cluster memberships
similarity matrix
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.
Simtocl
Sim
Sim[i,j]==1
Sim[i,k]==1
Sim[j,k]==1.
comp.psm for an average similarity matrix.
comp.psm
# NOT RUN { 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 # }
Run the code above in your browser using DataLab