spca(X, ncomp = 3, center = TRUE, scale = TRUE,
keepX = rep(ncol(X),ncomp), max.iter = 500,
tol = 1e-06)
X
can be supplied.
The value is passed to s
TRUE
. See details.spca
returns a list with class "spca"
containing the following components:scale= TRUE
is highly recommended as it will help obtaining orthogonal sparse loading vectors.
keepX
is the number of variables to keep in loading vectors. The difference between number of columns
of X
and keepX
is the degree of sparsity, which refers to the number of zeros in each loading vector.
Note that spca
does not apply to the data matrix with missing values. The biplot function for spca
is not available.
pca
and http://www.mixOmics.org for more details.data(liver.toxicity)
spca.rat <- spca(liver.toxicity$gene, ncomp = 3, keepX = rep(50, 3))
spca.rat
## variable representation
plotVar(spca.rat, X.label = TRUE, cex = 0.5)
plot3dVar(spca.rat)
## samples representation
plotIndiv(spca.rat, ind.names = liver.toxicity$treatment[, 3],
group = as.numeric(liver.toxicity$treatment[, 3]))
plot3dIndiv(spca.rat, cex = 0.01,
col = as.numeric(liver.toxicity$treatment[, 3]))
Run the code above in your browser using DataLab