truncPC {cellWise}R Documentation

Classical Principal Components by truncated SVD.

Description

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.

Usage

truncPC(X, ncomp = NULL, scale = FALSE, center = TRUE, 
                    signflip = TRUE, via.svd = NULL, scores = FALSE)

Arguments

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.

Value

A list with components:

rank

the (numerical) matrix rank of X, i.e. an integer number between 0 and min(dim(x)).

eigenvalues

the k eigenvalues, proportional to the variances, where k is the rank above.

loadings

the loadings, a d \times k matrix.

scores

if the scores argument was TRUE, the n \times k matrix of scores.

center

a vector of means, unless the center argument was FALSE.

scale

a vector of column scales, unless the scale argument was false.

Author(s)

P.J. Rousseeuw

See Also

classPC

Examples

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)

[Package cellWise version 2.5.3 Index]