sp.hclust: Hierarchical Clustering for Data on Hypersphere

Description Usage Arguments Value Examples

View source: R/sp.hclust.R

Description

Hierarchical Clustering for Data on Hypersphere

Usage

1
2
3
4
5
6
7
sp.hclust(
  x,
  type = c("intrinsic", "extrinsic"),
  method = c("single", "complete", "average", "mcquitty", "ward.D", "ward.D2",
    "centroid", "median"),
  members = NULL
)

Arguments

x

an (n\times p) row-stacked matrix for \mathbb{S}^{p-1}.

type

type of distance, either "intrinsic" or "extrinsic".

method

the agglomeration method to be used. This must be (an unambiguous abbreviation of) one of "single", "complete", "average", "mcquitty", "ward.D", "ward.D2", "centroid" or "median".

members

NULL or a vector whose length equals the number of observations. See hclust for details.

Value

an object of class hclust. See hclust for details.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
## generate two-cluster data
mymu1 = c(0,0,0,1)  # center of class 1
mymu2 = c(-1,0,0,0) # center of class 2

x1 = rvmf(20, mymu1, kappa=5)
x2 = rvmf(20, mymu2, kappa=5)
xx = rbind(x1,x2)

## apply hierarchical clustering with different methods
hc1 <- sp.hclust(xx, method="single")
hc2 <- sp.hclust(xx, method="complete")
hc3 <- sp.hclust(xx, method="average")

## visualize
## Not run: 
opar <- par(mfrow=c(1,3), pty="s")
plot(hc1, main="'single'")
plot(hc2, main="'complete'")
plot(hc3, main="'average'")
par(opar)

## End(Not run)

kisungyou/RiemSphere documentation built on April 11, 2020, 4:04 a.m.