Description Usage Arguments Value Examples
Calculate the silhouette coefficient of each sample, and take the average value.
1 |
x |
A data matrix with columns as features (e.g. genes) and rows as samples (e.g, patients). |
a |
A vector that contains the cluster label of each sample. |
type |
Choose from 0, 1 or 2, which means the data matrix x is the raw data matrix, similarity matrix, and distance matrix respectively. |
A real number that means the silhouette coefficient of the cluster.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #sample one
s1=c(3,1,6,4,8)
#sample two
s2=c(6,7,1,3,4)
#sample three
s3=c(2,8,7,2,3)
label=c(1,1,3)
x=as.matrix(rbind(s1,s2,s3))
#the first parameter is row data
calSI(x,label,0)
#the first parameter is similarity matrix
calSI(1/dist(x),label,1)
#the first parameter is distance matrix
calSI(dist(x),label,2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.