davesil: Modified version of silhouette plotting

Description Usage Arguments Details Value Author(s) References Examples

View source: R/davesil.R

Description

This is a wrapper for function silhouette in the cluster package. It also relies on the output of hclust and cutree.

Usage

1
2
3
4
5
6
7
davesil(ddist, o.hclr, o.relgr, ...)
dsil(ddist, o.hclr, o.relgr)

## Default S3 method:
davesil(ddist, o.hclr, o.relgr, ...)
## S3 method for class 'davesil'
plot(x,...,range=NULL)

Arguments

ddist

A distance matrix, probably the same as used for clustering

o.hclr

Output object of function hclust()

o.relgr

Output object of function cutree()

...

Plot parameter range(a,b) can be specified to limit plot to the subsed specified by a (begin) and b (end).

x

An object of class "davesil"

range

A vector of length 2, allows to plot a portion of the silhouette, e.g., range=c(1,5) plots the first 5.

Details

See function silhouette in the cluster package.

Value

An output list of class "davesil" with at least the following items:

sil

Data for drawing the silhouette, computed by silhouette()

names

The names of the items clustered, first 15 characters, used for plotting

Author(s)

Otto Wildi

References

Rousseeuw, P.J. (1987). Silhouettes: A graphical aid to the interpretation and validation of cluster analysis. J. Comput. Appl. Math., 20: 53-65.

Wildi, O. 2017. Data Analysis in Vegetation Ecology. 3rd ed. CABI, Oxfordshire, Boston.

Examples

1
2
3
4
5
6
7
# An oridinary cluster analysis
ddr<- as.dist((1-cor(t(nveg)))/2)         # distance matrix, correlation as distance
o.hclr<- hclust(ddr,method="complete")
o.relgr<- cutree(o.hclr,k=3)
# Getting silhouette plot
o.davesil<- davesil(ddr,o.hclr,o.relgr)
plot(o.davesil)

dave documentation built on May 2, 2019, 1:30 p.m.