Learn R Programming

kmed (version 0.0.1)

consensusmatrix: A consensus matrix from A bootstrap replicate matrix

Description

This function create a consensus matrix from a bootstrap replicate matrix.

Usage

consensusmatrix(bootdata, nclust, reorder)

Arguments

bootdata

A matrix of bootstrap replicate (n x b) membership.

nclust

The number of clusters

reorder

Any clustering algorithm function with the input is a distance and the end result being only membership.

Value

Function returns a consensus matrix (n x n).

Details

This is a function to obtain a consensus matrix from a bootstrap evaluation for a cluster. The consensus matrix can be further plotted.

Examples

Run this code
# NOT RUN {
num <- as.matrix(iris[,1:4])
mrwdist <- distNumeric(num, num, method = "mrw")
parkboot <- function(x, nclust) {
res <- fastkmed(x, nclust, iterate = 50)
return(res$cluster)
}
irisboot <- clustboot(mrwdist, nclust=3, parkboot, nboot=7)
wardorder <- function(x, nclust) {
res <- hclust(x, method = "ward.D2")
member <- cutree(res, nclust)
return(member)
}
consensusiris <- consensusmatrix(irisboot, nclust = 3, wardorder)
consensusiris[c(1:5,51:55,101:105),c(1:5,51:55,101:105)]

# }

Run the code above in your browser using DataLab