Eigenvalues and eigenvectors in high dimensional principal component analysis {Rfast}R Documentation

Eigenvalues in high dimensional principal component analysis

Description

Eigenvalues in high dimensional (n<<p) principal component analysis.

Usage

hd.eigen(x, center = TRUE, scale = FALSE, k = NULL, vectors = FALSE, large = FALSE)

Arguments

x

A numerical n \times p matrix with data where the rows are the observations and the columns are the variables.

center

Do you want your data centered? TRUE or FALSE.

scale

Do you want each of your variables scaled, i.e. to have unit variance? TRUE or FALSE.

k

If you want a specific number of eigenvalues and eigenvectors set it here, otherwise all eigenvalues (and eigenvectors if requested) will be returned.

vectors

Do you want the eigenvectors be returned? By dafault this is FALSE.

large

If you have large matrices, with thousands of rows and or many tens or hundreds of columns set this equal to TRUE in order to use Rfast's Crossprod or Tcrossprod functions. These functions are twice or up to 3 times faster than the correpsonding built-in functions.

Details

When n<<p, at most the first n eigenvalues are non zero. Hence, there is no need to calculate the other p-n zero eigenvalues. When center is TRUE, the eigenvalues of the covariance matrix are calculated. When both the center and scale is TRUE the eigenvalues of the correlation matrix are calculated. One or more eigenvectors (towards the end) will be 0. In general the signs might be the opposite than R's, but this makes no difference. We use the Crossprod instead of the relevant built-in function. The higher the dimensions of the matrix are the faster this function becomes.

Value

A list including:

values

A vector with the n (or first k) eigenvalues. The divisor in the crossproduc matrix is n-1 and not n.

vectors

A matrix of p \times n or p \times k eigenvectors.

Author(s)

Michail Tsagris.

R implementation and documentation: Michail Tsagris <mtsagris@uoc.gr>.

See Also

rmdp

Examples

x <- matrnorm( 40, 100)
a <- hd.eigen(x, FALSE, FALSE)
b <- prcomp(x, center = FALSE, scale = FALSE)
a
b$sdev^2
x <- NULL

[Package Rfast version 2.1.0 Index]