View source: R/affinesubspace_dist_conway.R
Distance using Conway Embedding
1 | dist_conway(list_center, list_stiefel)
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ## Not run:
# example with Iris data
X = as.matrix(iris[,1:4])
lab = as.factor(iris[,5])
digs = diglocal_fixed(X, center.by.data=FALSE)
# compute the distance
dobj = dist_conway(digs$center, digs$stiefel)
# embed by MDS
embed2_data = cmdscale(stats::dist(X), k=2)
embed2_conway = cmdscale(dobj, k=2)
# visualize
opar <- par(no.readonly=TRUE)
par(mfrow=c(1,2), pty="s")
plot(embed2_data, col=lab, pch=19, main="Data MDS")
plot(embed2_conway, col=lab, pch=19, main="Graff MDS")
par(opar)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.