# NOT RUN {
## use iris data
data(iris)
X = as.matrix(iris[,1:4])
label = as.integer(iris$Species)
## Compare PCA and PPCA
PCA <- do.pca(X, ndim=2, preprocess="center")
PPCA <- do.ppca(X, ndim=2, preprocess="center")
## Visualize
opar <- par(no.readonly=TRUE)
par(mfrow=c(1,2))
plot(PCA$Y, col=label, main="PCA")
plot(PPCA$Y, col=label, main="PPCA")
par(opar)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab