Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

dser

Implements dendrogram seriation. Interface to DendSer.


Description

Implements dendrogram seriation. Interface to DendSer.

Usage

dser(x,ser_weight,cost=costBAR, ...)

## S3 method for class 'data.frame'
dser(x,ser_weight,cost=costBAR,...)

## S3 method for class 'matrix'
dser(x,ser_weight,cost=costBAR,scale=TRUE,dmethod="euclidean",...)

## S3 method for class 'dist'
dser(x,ser_weight,cost=costBAR,hmethod="average",...)

## S3 method for class 'hclust'
dser(x,ser_weight,cost=costBAR,...)

Arguments

x

Used to select method.

ser_weight

Seriation weights. For cost=costLS, defaults to first column of matrix x, otherwise to symmetric matrix version of dist d.

cost

Current choices are costLS, costPL, costLPL, costED, costARc, costBAR.

scale

Logical value,controls whether matrix x should be scaled prior to forming dist.

dmethod

Method of dist calculation. See function dist.

hmethod

Method of hclust calculation. See function hclust.

...

Other args

Details

When x is a matrix or data.drame, forms a dist of rows using function dist with method = dmethod. When x is a dist, forms a hclust with method = hmethod which is then reordered.

Value

Numeric vector giving an optimal dendrogram order

Author(s)

Catherine Hurley & Denise Earle

Examples

require(DendSer) 			

iriss <- scale(iris[,-5])
plotAsColor(iriss,order.row=dser(iriss))



w <- prcomp(iris[,-5],scale=TRUE)$x[,1]
h<- hclust(dist(iriss))
h$order <- ow <- dser(h,w,cost=costLS) # arranges cases along first PC, within dendrogram


# compare re-rordered dendrogram to PC scores, w
dev.new(width=10,height=5)
par(mar=c(0,2,1,1))
layout(matrix(1:2, nrow = 2), heights = c(4,1.5) )
par(cex=.7)
plot(h,main="",xlab="",hang=-1,labels=FALSE)
u <- par("usr")
par(mar=c(1,2,0,1))
 

plot.new()
par(usr=c(u[1:2],min(w),max(w)))

x<- 1:length(w)
rect(x-.5,0,x+.5,w[ow],col=cutree(h,3)[ow]+1)

DendSer

Dendrogram seriation: ordering for visualisation

v1.0.1
GPL-2
Authors
Catherine B. Hurley and Denise Earle
Initial release
2013-09-09

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.