# \donttest{
## use iris data
data(iris)
set.seed(100)
subid = sample(1:150, 50)
X = as.matrix(iris[subid,1:4])
label = as.factor(iris[subid,5])
## Compare PCA and PPCA
PCA <- do.pca(X, ndim=2)
PPCA <- do.ppca(X, ndim=2)
## Visualize
opar <- par(no.readonly=TRUE)
par(mfrow=c(1,2))
plot(PCA$Y, pch=19, col=label, main="PCA")
plot(PPCA$Y, pch=19, col=label, main="PPCA")
par(opar)
# }
Run the code above in your browser using DataLab