cd03-1-BootstrapClusterTest-class: Class "BootstrapClusterTest"

Description Usage Arguments Objects from the Class Slots Extends Methods Author(s) References See Also Examples

Description

Performs a nonparametric bootstrap (sampling with replacement) test to determine whether the clusters found by an unsupervised method appear to be robust in a given data set.

Usage

1
BootstrapClusterTest(data, FUN, subsetSize, nTimes=100, verbose=TRUE, ...)

Arguments

data

A data matrix, numerical data frame, or ExpressionSet object.

FUN

A function that, given a data matrix, returns a vector of cluster assignments. Examples of functions with this behavior are cutHclust, cutKmeans, cutPam, and cutRepeatedKmeans.

...

Additional arguments passed to the classifying function, FUN.

subsetSize

An optional integer argument. If present, each iteration of the bootstrap selects subsetSize rows from the original data matrix. If missing, each bootstrap contains the same number of rows as the original data matrix.

nTimes

The number of bootstrap samples to collect.

verbose

A logical flag

Objects from the Class

Objects should be created using the BootstrapClusterTest function, which performs the requested bootstrap on the clusters. Following the standard R paradigm, the resulting object can be summarized and plotted to determine the results of the test.

Slots

f:

A function that, given a data matrix, returns a vector of cluster assignments. Examples of functions with this behavior are cutHclust, cutKmeans, cutPam, and cutRepeatedKmeans.

subsetSize:

The number of rows to be included in each bootstrap sample.

nTimes:

An integer, the number of bootstrap samples that were collected.

call:

An object of class call, which records how the object was produced.

result:

Object of class matrix containing, for each pair of columns in the original data, the number of times they belonged to the same cluster of a bootstrap sample.

Extends

Class ClusterTest, directly. See that class for descriptions of the inherited methods image and hist.

Methods

summary

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

Author(s)

Kevin R. Coombes krc@silicovore.com

References

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

See Also

ClusterTest, PerturbationClusterTest

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
showClass("BootstrapClusterTest")

## simulate data from two different groups
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)
cols <- rep(c('red', 'green'), times=c(30,20))
colnames(dd) <- paste(cols, c(1:30, 1:20), sep='')
## peform your basic hierarchical clustering...
hc <- hclust(distanceMatrix(dd, 'pearson'), method='complete')

## bootstrap the clusters arising from hclust
bc <- BootstrapClusterTest(dd, cutHclust, nTimes=200, k=3, metric='pearson')
summary(bc)

## look at the distribution of agreement scores
hist(bc, breaks=101)

## let heatmap compute a new dendrogram from the agreement
image(bc, col=blueyellow(64), RowSideColors=cols, ColSideColors=cols)

## plot the agreement matrix with the original dendrogram
image(bc, dendrogram=hc, col=blueyellow(64), RowSideColors=cols, ColSideColors=cols)

## bootstrap the results of PAM
pamc <- BootstrapClusterTest(dd, cutPam, nTimes=200, k=3)
image(pamc, dendrogram=hc, col=blueyellow(64), RowSideColors=cols, ColSideColors=cols)

## contrast the behavior when all the data comes from the same group
xx <- matrix(rnorm(100*50, rnorm(100, 0.5)), nrow=100, ncol=50, byrow=FALSE)
hct <- hclust(distanceMatrix(xx, 'pearson'), method='complete')
bct <- BootstrapClusterTest(xx, cutHclust, nTimes=200, k=4, metric='pearson')
summary(bct)
image(bct, dendrogram=hct, col=blueyellow(64), RowSideColors=cols, ColSideColors=cols)

## cleanup
rm(d1, d2, dd, cols, hc, bc, pamc, xx, hct, bct)

Example output

Loading required package: cluster
Loading required package: oompaBase
Class "BootstrapClusterTest" [package "ClassDiscovery"]

Slots:
                                                             
Name:           f subsetSize     nTimes       call     result
Class:   function    numeric    numeric       call     matrix

Extends: "ClusterTest"
[1] 100 [2] 100 [3] 100 [4] 100 [5] 100 [6] 100 [7] 100 [8] 100 [9] 100 [10] 100 
[11] 100 [12] 100 [13] 100 [14] 100 [15] 100 [16] 100 [17] 100 [18] 100 [19] 100 [20] 100 
[21] 100 [22] 100 [23] 100 [24] 100 [25] 100 [26] 100 [27] 100 [28] 100 [29] 100 [30] 100 
[31] 100 [32] 100 [33] 100 [34] 100 [35] 100 [36] 100 [37] 100 [38] 100 [39] 100 [40] 100 
[41] 100 [42] 100 [43] 100 [44] 100 [45] 100 [46] 100 [47] 100 [48] 100 [49] 100 [50] 100 
[51] 100 [52] 100 [53] 100 [54] 100 [55] 100 [56] 100 [57] 100 [58] 100 [59] 100 [60] 100 
[61] 100 [62] 100 [63] 100 [64] 100 [65] 100 [66] 100 [67] 100 [68] 100 [69] 100 [70] 100 
[71] 100 [72] 100 [73] 100 [74] 100 [75] 100 [76] 100 [77] 100 [78] 100 [79] 100 [80] 100 
[81] 100 [82] 100 [83] 100 [84] 100 [85] 100 [86] 100 [87] 100 [88] 100 [89] 100 [90] 100 
[91] 100 [92] 100 [93] 100 [94] 100 [95] 100 [96] 100 [97] 100 [98] 100 [99] 100 [100] 100 
[101] 100 [102] 100 [103] 100 [104] 100 [105] 100 [106] 100 [107] 100 [108] 100 [109] 100 [110] 100 
[111] 100 [112] 100 [113] 100 [114] 100 [115] 100 [116] 100 [117] 100 [118] 100 [119] 100 [120] 100 
[121] 100 [122] 100 [123] 100 [124] 100 [125] 100 [126] 100 [127] 100 [128] 100 [129] 100 [130] 100 
[131] 100 [132] 100 [133] 100 [134] 100 [135] 100 [136] 100 [137] 100 [138] 100 [139] 100 [140] 100 
[141] 100 [142] 100 [143] 100 [144] 100 [145] 100 [146] 100 [147] 100 [148] 100 [149] 100 [150] 100 
[151] 100 [152] 100 [153] 100 [154] 100 [155] 100 [156] 100 [157] 100 [158] 100 [159] 100 [160] 100 
[161] 100 [162] 100 [163] 100 [164] 100 [165] 100 [166] 100 [167] 100 [168] 100 [169] 100 [170] 100 
[171] 100 [172] 100 [173] 100 [174] 100 [175] 100 [176] 100 [177] 100 [178] 100 [179] 100 [180] 100 
[181] 100 [182] 100 [183] 100 [184] 100 [185] 100 [186] 100 [187] 100 [188] 100 [189] 100 [190] 100 
[191] 100 [192] 100 [193] 100 [194] 100 [195] 100 [196] 100 [197] 100 [198] 100 [199] 100 [200] 100 

Number of bootstrap samples: 200.
Number of rows sampled: 100.
A BootstrapClusterTest object.

Call:
	 BootstrapClusterTest(data = dd, FUN = cutHclust, nTimes = 200, k = 3, metric = "pearson") 

Agreement levels:
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
 0.0000  0.0000  0.8050  0.4837  0.9750  1.0000 
[1] 100 [2] 100 [3] 100 [4] 100 [5] 100 [6] 100 [7] 100 [8] 100 [9] 100 [10] 100 
[11] 100 [12] 100 [13] 100 [14] 100 [15] 100 [16] 100 [17] 100 [18] 100 [19] 100 [20] 100 
[21] 100 [22] 100 [23] 100 [24] 100 [25] 100 [26] 100 [27] 100 [28] 100 [29] 100 [30] 100 
[31] 100 [32] 100 [33] 100 [34] 100 [35] 100 [36] 100 [37] 100 [38] 100 [39] 100 [40] 100 
[41] 100 [42] 100 [43] 100 [44] 100 [45] 100 [46] 100 [47] 100 [48] 100 [49] 100 [50] 100 
[51] 100 [52] 100 [53] 100 [54] 100 [55] 100 [56] 100 [57] 100 [58] 100 [59] 100 [60] 100 
[61] 100 [62] 100 [63] 100 [64] 100 [65] 100 [66] 100 [67] 100 [68] 100 [69] 100 [70] 100 
[71] 100 [72] 100 [73] 100 [74] 100 [75] 100 [76] 100 [77] 100 [78] 100 [79] 100 [80] 100 
[81] 100 [82] 100 [83] 100 [84] 100 [85] 100 [86] 100 [87] 100 [88] 100 [89] 100 [90] 100 
[91] 100 [92] 100 [93] 100 [94] 100 [95] 100 [96] 100 [97] 100 [98] 100 [99] 100 [100] 100 
[101] 100 [102] 100 [103] 100 [104] 100 [105] 100 [106] 100 [107] 100 [108] 100 [109] 100 [110] 100 
[111] 100 [112] 100 [113] 100 [114] 100 [115] 100 [116] 100 [117] 100 [118] 100 [119] 100 [120] 100 
[121] 100 [122] 100 [123] 100 [124] 100 [125] 100 [126] 100 [127] 100 [128] 100 [129] 100 [130] 100 
[131] 100 [132] 100 [133] 100 [134] 100 [135] 100 [136] 100 [137] 100 [138] 100 [139] 100 [140] 100 
[141] 100 [142] 100 [143] 100 [144] 100 [145] 100 [146] 100 [147] 100 [148] 100 [149] 100 [150] 100 
[151] 100 [152] 100 [153] 100 [154] 100 [155] 100 [156] 100 [157] 100 [158] 100 [159] 100 [160] 100 
[161] 100 [162] 100 [163] 100 [164] 100 [165] 100 [166] 100 [167] 100 [168] 100 [169] 100 [170] 100 
[171] 100 [172] 100 [173] 100 [174] 100 [175] 100 [176] 100 [177] 100 [178] 100 [179] 100 [180] 100 
[181] 100 [182] 100 [183] 100 [184] 100 [185] 100 [186] 100 [187] 100 [188] 100 [189] 100 [190] 100 
[191] 100 [192] 100 [193] 100 [194] 100 [195] 100 [196] 100 [197] 100 [198] 100 [199] 100 [200] 100 

[1] 100 [2] 100 [3] 100 [4] 100 [5] 100 [6] 100 [7] 100 [8] 100 [9] 100 [10] 100 
[11] 100 [12] 100 [13] 100 [14] 100 [15] 100 [16] 100 [17] 100 [18] 100 [19] 100 [20] 100 
[21] 100 [22] 100 [23] 100 [24] 100 [25] 100 [26] 100 [27] 100 [28] 100 [29] 100 [30] 100 
[31] 100 [32] 100 [33] 100 [34] 100 [35] 100 [36] 100 [37] 100 [38] 100 [39] 100 [40] 100 
[41] 100 [42] 100 [43] 100 [44] 100 [45] 100 [46] 100 [47] 100 [48] 100 [49] 100 [50] 100 
[51] 100 [52] 100 [53] 100 [54] 100 [55] 100 [56] 100 [57] 100 [58] 100 [59] 100 [60] 100 
[61] 100 [62] 100 [63] 100 [64] 100 [65] 100 [66] 100 [67] 100 [68] 100 [69] 100 [70] 100 
[71] 100 [72] 100 [73] 100 [74] 100 [75] 100 [76] 100 [77] 100 [78] 100 [79] 100 [80] 100 
[81] 100 [82] 100 [83] 100 [84] 100 [85] 100 [86] 100 [87] 100 [88] 100 [89] 100 [90] 100 
[91] 100 [92] 100 [93] 100 [94] 100 [95] 100 [96] 100 [97] 100 [98] 100 [99] 100 [100] 100 
[101] 100 [102] 100 [103] 100 [104] 100 [105] 100 [106] 100 [107] 100 [108] 100 [109] 100 [110] 100 
[111] 100 [112] 100 [113] 100 [114] 100 [115] 100 [116] 100 [117] 100 [118] 100 [119] 100 [120] 100 
[121] 100 [122] 100 [123] 100 [124] 100 [125] 100 [126] 100 [127] 100 [128] 100 [129] 100 [130] 100 
[131] 100 [132] 100 [133] 100 [134] 100 [135] 100 [136] 100 [137] 100 [138] 100 [139] 100 [140] 100 
[141] 100 [142] 100 [143] 100 [144] 100 [145] 100 [146] 100 [147] 100 [148] 100 [149] 100 [150] 100 
[151] 100 [152] 100 [153] 100 [154] 100 [155] 100 [156] 100 [157] 100 [158] 100 [159] 100 [160] 100 
[161] 100 [162] 100 [163] 100 [164] 100 [165] 100 [166] 100 [167] 100 [168] 100 [169] 100 [170] 100 
[171] 100 [172] 100 [173] 100 [174] 100 [175] 100 [176] 100 [177] 100 [178] 100 [179] 100 [180] 100 
[181] 100 [182] 100 [183] 100 [184] 100 [185] 100 [186] 100 [187] 100 [188] 100 [189] 100 [190] 100 
[191] 100 [192] 100 [193] 100 [194] 100 [195] 100 [196] 100 [197] 100 [198] 100 [199] 100 [200] 100 

Number of bootstrap samples: 200.
Number of rows sampled: 100.
A BootstrapClusterTest object.

Call:
	 BootstrapClusterTest(data = xx, FUN = cutHclust, nTimes = 200, k = 4, metric = "pearson") 

Agreement levels:
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
 0.2100  0.6650  0.7850  0.7563  0.8900  0.9800 

ClassDiscovery documentation built on July 16, 2021, 5:08 p.m.