Plot Projection and Contour {EMCluster} | R Documentation |
The function plots multivariate data on 2D plane with contour.
Typically, the contour is built via projection pursuit or SVD
algorithms, such as project.on.2d()
.
plotppcontour(da, Pi, Mu, S, class, class.true = NULL, n.grid = 128, angle = 0, xlab = "", ylab = "", main = "")
da |
a projected data matrix, dimension n * 2. |
Pi |
proportion, length K. |
Mu |
the projected centers of cluster, dimension K * 2. |
S |
projected matrices of dispersion, dimension 2 * 2 * K. |
class |
id of classifications, length n. |
class.true |
ture id of classifications if available, length n. |
n.grid |
number of grid points. |
angle |
a rotation angle (0 to 2 pi). |
xlab |
an option for |
ylab |
an option for |
main |
an option for |
This function plots projection output of project.on.2d()
.
da
, Mu
, and S
are projected by some projection matrices
obtained via SVD or projection pursuit algorithms. The projection is made
on a 2D plane in the direction in which clusters of data x
are most distinguishable to visualize.
A 2D projection plot is returned.
Only distinguishable for up to 7 clusters due to the limited color schemes.
Wei-Chen Chen wccsnow@gmail.com and Ranjan Maitra.
https://www.stat.iastate.edu/people/ranjan-maitra/
## Not run: library(EMCluster, quietly = TRUE) library(MASS, quietly = TRUE) set.seed(1234) ### Crabs. x <- as.matrix(crabs[, 4:8]) ret <- init.EM(x, nclass = 4, min.n = 20) ret.proj <- project.on.2d(x, ret) ### Plot. pdf("crabs_ppcontour.pdf", height = 5, width = 5) plotppcontour(ret.proj$da, ret.proj$Pi, ret.proj$Mu, ret.proj$S, ret.proj$class, angle = pi/6, main = "Crabs K = 4") dev.off() ## End(Not run)