Learn R Programming

ClassDiscovery (version 3.4.0)

ClusterTest-class: Class "ClusterTest"

Description

This is a base class for tests that attempt to determine whether the groups found by an unsupervised clustering method are statistically significant.

Usage

# S4 method for ClusterTest
image(x, dendrogram, …)

Arguments

x

An object of the ClusterTest class.

dendrogram

An object with S3 class hclust, as returned by the hclust function.

Additional graphical parameters to be passed to the standard heatmap function that is used to implement the image method.

Objects from the Class

Objects can be created by calls of the form new("ClusterTest", …). Most users, however, will only create objects from one of the derived classes such as BootstrapClusterTest or PerturbationClusterTest.

Slots

call:

An object of class call, which shows how the object was constructed.

result:

A symmetric matrix containing the results of the cluster reproducibility test. The size of the matrix corresponds to the number of samples (columns) in the data set on which the test was performed. The result matrix should contain "agreement" values between 0 and 1, representing for each pair of samples the fraction of times that they were collected into the same cluster.

Methods

hist

signature(x = "ClusterTest"): Produces a histogram of the agreement fractions. When a true group structure exists, one expects a multimodal distribution,with one group of agreements near 0 (for pairs belonging to different clusters) and one group of agreements near 1 (for pairs belonging to the same cluster).

image

signature(x = "ClusterTest"): Uses the heatmap function to display the agreement matrix. The optional dendrogram argument should be used to display the extent to which the agreement matrix matches the results of hierarchical clustering using the full data set. This method invisibly returns the result of a call to heatmap; thus, you can use keep.dendro=TRUE to recover the cluster assignments from the dendrograms.

summary

signature(object = "ClusterTest"): Write out a summary of the object.

References

Kerr MK, Churchill GJ. Bootstrapping cluster analysis: Assessing the reliability of conclusions from microarray experiments. PNAS 2001; 98:8961-8965.

See Also

BootstrapClusterTest, PerturbationClusterTest, heatmap

Examples

Run this code
# NOT RUN {
showClass("ClusterTest")

## simulate data from two different classes
d1 <- matrix(rnorm(100*30, rnorm(100, 0.5)), nrow=100, ncol=30, byrow=FALSE)
d2 <- matrix(rnorm(100*20, rnorm(100, 0.5)), nrow=100, ncol=20, byrow=FALSE)
dd <- cbind(d1, d2)

## cluster the data
hc <- hclust(distanceMatrix(dd, 'pearson'), method='average')

## make a fake reproducibility matrix
fraud <- function(x) {
  new('ClusterTest', result=abs(cor(x)), call=match.call())
}

fake <- fraud(dd)
summary(fake)

hist(fake)

image(fake) # let heatmap compute a new dendrogram from the agreements

image(fake, dendrogram=hc) # use the actual dendrogram from the data

image(fake, dendrogram=hc, col=blueyellow(64)) # change the colors

## cleanup
rm(fake, fraud, hc, dd, d1, d2)
# }

Run the code above in your browser using DataLab