# NOT RUN {
## generate default dataset and make its dimension three-folds.
Xp <- aux.gensamples()
X <- cbind(Xp,Xp,Xp)
## try different regularization parameters for sparsity
out1 <- do.spca(X,ndim=2,rho=0.01)
out2 <- do.spca(X,ndim=2,rho=1)
out3 <- do.spca(X,ndim=2,rho=100)
## Visualize principal components as columns in an image
opar <- par(no.readonly=TRUE)
par(mfrow=c(1,3))
image(t(out1$projection), main="SPCA::rho=0.01")
image(t(out2$projection), main="SPCA::rho=1")
image(t(out3$projection), main="SPCA::rho=100")
par(opar)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab