pca_nspike {bigutilsr}R Documentation

Number of spikes in PCA

Description

Estimate the number of distant spikes based on the histogram of eigenvalues.

Usage

pca_nspike(eigval, breaks = "FD", nboot = 100)

Arguments

eigval

Eigenvalues (squared singular values).

breaks

Same parameter as for hist(). Default uses a robust version of Scott's rule. You can also use "FD" or nclass.FD for a bit more bins.

nboot

Number of bootstrap replicates to estimate limits more robustly. Default is 100.

Value

The estimated number of distant spikes.

Examples

N <- 400; M <- 2000; K <- 8
U <- matrix(0, N, K); U[] <- rnorm(length(U))
V <- matrix(0, M, K); V[] <- rnorm(length(V))
# X = U V^T + E
X <- tcrossprod(U, V) + 15 * rnorm(N * M)
pca <- prcomp(X)
eigval <- pca$sdev^2
plot(head(eigval, -1), log = "xy", pch = 20)
pca_nspike(eigval)


[Package bigutilsr version 0.3.4 Index]