fixNonMonotHca: fixNonMonotHca

fixNonMonotHcaR Documentation

fixNonMonotHca

Description

Solving non-monotonous heights in HCA clustering.

Usage

fixNonMonotHca(hca, method = c("eps", "halfway"), eps = NULL)

Arguments

hca

an object of class hclust

method

replacement method, one of 'eps', and 'halfway'. The 'eps' method makes the non-monotonous heights to be monotonous by shifting them just above the last monotonous height (eps above it). The resulting heights are close to reality, eventhough the denrogram is not so visually appealing. The 'halfway' method replaces the non-monotonous heights with heights lying halfway between neighbouring monotonous heights. This gives nicer dendrogram at the expense of making the heights too artificial. See examples.

eps

parameter of the 'eps' method, if NULL, it defaults to half of the minimal positive difference in monotonous heights, or 1, if there are no consecutive monotonous heights.

Details

fixNonMonotHca replaces non-monotonous heights in a dendrogram representing a hierarchical clustering with artificial values making the heights monotonous. However, please note that non-monotonous heights appear naturally in dendrograms resulting from some HCA methods including link{mhclust}, such that altering the heights result in artificial dendrograms that do NOT represent the structure of the clustered data. Please consider using HCA methods producing monotonous before attempting to remove the non-monotonous heights, e.g. for the purpose of graphical presentation of the dendrogram.

Value

An object of class link[stats]{hclust} having the height component fixed.

Author(s)

Tomas Sieger, Karel Fiser

Examples

# simple example
d<-cbind(1:3,1:3)
hd<-mhclust(d)
# original dendrogram
print(hd$height)
hdFixed<-fixNonMonotHca(hd)
# dendrogram with resolved non-monotonous heights
print(hdFixed$height)

# another example
set.seed(1)
x<-cbind(runif(20),runif(20))
hx<-hclust(dist(x)^2,'cen')
hx1<-fixNonMonotHca(hx,method='eps')
hx2<-fixNonMonotHca(hx,method='halfway')
opar<-par(mfrow=c(1,3))
plot(hx,main='Original')
plot(hx1,main='Fixed by the "eps" method')
plot(hx2,main='Fixed by the "halfway" method')
par(opar)

tsieger/mhca documentation built on June 5, 2023, 7:26 p.m.