perm_ci.pca: Permutation-Based Confidence Intervals for PCA Components

View source: R/pca.R

perm_ci.pcaR Documentation

Permutation-Based Confidence Intervals for PCA Components

Description

Perform a permutation test to assess the significance of variance explained by PCA components.

Usage

## S3 method for class 'pca'
perm_ci(x, X, nperm = 100, k = 4, distr = "gamma", parallel = FALSE, ...)

Arguments

x

A PCA object from pca().

X

The original data matrix used for PCA.

nperm

Number of permutations.

k

Number of components (beyond the first) to test. Default tests up to min(Q-1, k).

distr

Distribution to fit to the permutation results ("gamma", "norm", or "empirical").

parallel

Logical, whether to use parallel processing for permutations.

...

Additional arguments passed to fitdistrplus::fitdist or parallelization.

Details

The function computes a statistic F_a for each component a, representing the fraction of variance explained relative to the remaining components. It then uses permutations of the preprocessed data to generate a null distribution. The first component uses the full data; subsequent components are tested by partialing out previously identified components and permuting the residuals.

By default, a gamma distribution is fit to the permuted values to derive CIs and p-values. If distr="empirical", it uses empirical quantiles instead.

Value

A list containing:

observed

The observed F_a values for tested components.

perm_values

A matrix of permuted F-values. Each column corresponds to a component.

fit

A list of fit objects or NULL if empirical chosen.

ci

Computed confidence intervals for each component.

p

p-values for each component.


bbuchsbaum/multivarious documentation built on Dec. 23, 2024, 7:47 a.m.