Learn R Programming

agricolae (version 1.0-4)

consensus: consensus of clusters

Description

The criterion of the consensus is to produce many trees by means of boostrap and to such calculate the relative frequency with members of the clusters.

Usage

consensus(data,distance=c("binary","euclidean","maximum","manhattan",
"canberra", "minkowski"),method=c("complete","ward","single","average",
"mcquitty","median", "centroid"),nboot=500,duplicate=TRUE,cex.text=1, 
col.text="red", ...)

Arguments

data
data frame
distance
method distance, see dist()
method
method cluster, see hclust()
nboot
The number of bootstrap samples desired.
duplicate
control is TRUE other case is FALSE
cex.text
size text on percentage consensus
col.text
color text on percentage consensus
...
parameters of the plot dendrogram

Value

  • datanumerical, the rownames is necesary'
  • nbootinteger
  • duplicatelogical TRUE or FALSE
  • cex.textsize text on consensus
  • col.textcolor text on consensus

Details

distance: "euclidean", "maximum", "manhattan", "canberra", "binary", "minkowski". Method: "ward", "single", "complete", "average", "mcquitty", "median", "centroid". see functions: dist(), hclust().

References

An Introduction to the Boostrap. Bradley Efron and Robert J. Tibshirani. 1993. Chapman and Hall/CRC

See Also

hclust, hgroups, hcut

Examples

Run this code
library(agricolae)
data(pamCIP)
# only code
rownames(pamCIP)<-substr(rownames(pamCIP),1,6)
par(cex=0.8)
output<-consensus( pamCIP,distance="binary", method="complete",nboot=500)
# Order consensus
Groups<-output$table.dend[,c(6,5)]
Groups<-Groups[order(Groups[,2],decreasing=TRUE),]
print(Groups)
# Identification of the codes with the numbers.
cbind(output$dendrogram$labels)
# To reproduce dendrogram
dend<-output$dendrogram
data<-output$table.dend
plot(dend)
text(data[,3],data[,4],data[,5])

# Other examples
# classical dendrogram
dend<-as.dendrogram(output$dendrogram)
plot(dend,type="r",edgePar = list(lty=1:2, col=2:1))
text(data[,3],data[,4],data[,5],col="blue",cex=1)
#
plot(dend,type="t",edgePar = list(lty=1:2, col=2:1))
text(data[,3],data[,4],data[,5],col="blue",cex=1)
# Without the control of duplicates
output<-consensus( pamCIP,duplicate=FALSE,nboot=500)

Run the code above in your browser using DataLab