Description Usage Arguments Value Author(s) Examples
Given the type of distance measure and agglomeration scheme method, gr.hclust performs hierarchical clustering on
Grassmann manifold using fastcluster package, which returns the same object as stats package's implementation while providing more efficient computation.
See hclust for more details.
1 2 3 4 5 6 7 |
x |
either an array of size (p\times r\times N) or a list of length N whose elements are (p\times r) matrix on Stiefel manifold. |
type |
type of distance measure; |
method |
he agglomeration method to be used. This must be (an unambiguous abbreviation of) one of |
members |
|
an object of class hclust. See hclust for details.
Kisung You
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | #-------------------------------------------------------------------
# Generate a dataset with two types of Stiefel elements
#-------------------------------------------------------------------
# group1 : first four columns of (8x8) identity matrix + noise
# group2 : last four columns of (8x8) identity matrix + noise
mydata = list()
sdval = 0.05
diag8 = diag(8)
for (i in 1:10){
mydata[[i]] = qr.Q(qr(diag8[,1:4] + matrix(rnorm(8*4,sd=sdval),ncol=4)))
}
for (i in 11:20){
mydata[[i]] = qr.Q(qr(diag8[,5:8] + matrix(rnorm(8*4,sd=sdval),ncol=4)))
}
## try hierarchical clustering
# compare 'intrinsic' and 'extrinsic' distance types
# and use 'single' hclust option.
hint = st.hclust(mydata, type="intrinsic", method="single")
hext = st.hclust(mydata, type="extrinsic", method="single")
## visualize
opar = par(no.readonly=TRUE)
par(mfrow=c(1,2), pty="s")
plot(hint, main="intrinsic")
plot(hext, main="extrinsic")
par(opar)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.