sigPCA: Statistical Significance Testing for Principal Components

Introduction

The sigPCA package provides tools to assess the statistical significance of principal components, based on the Marchenko–Pastur distribution derived from random matrix theory. This approach allows for rigorous determination of whether observed eigenvalues represent signal or noise in high-dimensional datasets.

The core method implemented here was developed by Dr. Enrique Hernández-Lemus and is grounded in theoretical results from random matrix theory. Additional empirical tools (e.g., permutation-based p-values) are available for comparison or exploratory analysis.

Basic Example: White Noise

We simulate a dataset of 100 observations with 10 variables, generated as white noise (no signal):

set.seed(123)
X_white <- matrix(rnorm(1000), nrow = 100, ncol = 10)
result_white <- sigPCA(X_white, method = "both", num_permutations = 100)
result_white$mp$significant_components
#> integer(0)

No components should be detected as significant.

plot_sigPCA(result_white$mp$eigenvalues, result_white$mp$mp_bounds)

Example: Latent Signal

Now we add signal by introducing strong correlation in the first two components:

set.seed(123)
  {
    n <- 100
    p <- 10
    k <- 2
    latent <- matrix(rnorm(n * k, mean = 3), nrow = n, ncol = k)
    loadings <- matrix(rnorm(p * k), nrow = k, ncol = p)
    noise <- matrix(rnorm(n * p, sd = 0.3), nrow = n, ncol = p)
    x <- latent %*% loadings + noise
    result_signal <- sigPCA(x, method = "mp")
  }

We expect at least two components to be significant.

plot_sigPCA(result_signal$mp$eigenvalues, result_signal$mp$mp_bounds)

Optional: Permutation-Based p-values

Permutation methods serve as empirical validation or sensitivity checks:

result_signal$perm$pvalues
#> NULL

Interpretation

The components with eigenvalues greater than the theoretical Marchenko–Pastur upper bound are considered statistically significant. These likely represent underlying structure or correlated signals in the data.

Permutation-based p-values provide an empirical check, but are not required when using the MP-based method.

References