truncPC {cellWise} | R Documentation |
Similar usage to robustbase::classPC except for the new argument ncomb
which is the desired number of components. Only this many PC's are computed in order to save computation time. Makes use of propack.svd
of package svd.
truncPC(X, ncomp = NULL, scale = FALSE, center = TRUE, signflip = TRUE, via.svd = NULL, scores = FALSE)
X |
a numeric matrix. |
ncomp |
the desired number of components (if not specified, all components are computed). |
scale |
logical, or numeric vector for scaling the columns. |
center |
logical or numeric vector for centering the matrix. |
signflip |
logical indicating if the signs of the loadings should be flipped such that the absolutely largest value is always positive. |
via.svd |
dummy argument for compatibility with classPC calls, will be ignored. |
scores |
logical indicating whether or not scores should be returned. |
A list with components:
rank |
the (numerical) matrix rank of |
eigenvalues |
the |
loadings |
the loadings, a d \times k matrix. |
scores |
if the |
center |
a vector of means, unless the center argument was |
scale |
a vector of column scales, unless the scale argument was false. |
P.J. Rousseeuw
library(MASS) set.seed(12345) n <- 100; d <- 10 A <- diag(d) * 0.1 + 0.9 x <- mvrnorm(n, rep(0,d), A) truncPCA.out <- truncPC(x, ncomp = 2, scores = TRUE) plot(truncPCA.out$scores)