Description Usage Arguments Value Examples
Hierarchical Clustering for Data on Hypersphere
1 2 3 4 5 6 7 |
x |
an (n\times p) row-stacked matrix for \mathbb{S}^{p-1}. |
type |
type of distance, either |
method |
the agglomeration method to be used. This must be (an unambiguous abbreviation of) one of |
members |
|
an object of class hclust
. See hclust
for details.
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.