Performs permutation-based significance testing for PCA loadings using the permV method (Linting et al., 2011). This approach permutes one variable at a time, providing variable-specific and component-specific significance thresholds with higher statistical power and proper Type I error control.
Usage
pcaloadingtest(
data,
vars,
ncomp = 3,
nperm = 1000,
componentfilter = 0,
center = TRUE,
scale = TRUE,
conflevel = 0.95,
adjustmethod = "BH",
colorlow = "steelblue1",
colormid = "white",
colorhigh = "firebrick1",
plotwidth = 700,
plotheight = 450
)Arguments
- data
The data as a data frame.
- vars
Continuous variables to include in Principal Component Analysis. Select at least 3 numeric variables.
- ncomp
Number of principal components to test loadings for (1 to 10).
- nperm
Number of permutations per variable (100-5000). Total permutations = nperm × number of variables. Higher values provide more accurate p-values but take longer.
- componentfilter
Filter results table by component. 0 shows all components, 1 shows only PC1, 2 shows only PC2, etc.
- center
Center variables to have mean = 0 before PCA.
- scale
Scale variables to have standard deviation = 1 before PCA.
- conflevel
Confidence level for confidence intervals (0.80-0.99).
- adjustmethod
Method for adjusting p-values within each component. BH (Benjamini-Hochberg) controls false discovery rate.
- colorlow
Color for negative loadings in barplot.
- colormid
Midpoint color for zero loading.
- colorhigh
Color for positive loadings in barplot.
- plotwidth
Width of the plot in pixels.
- plotheight
Height of the plot in pixels.
Value
A results object containing:
results$todo | a html | ||||
results$results | Permutation-based significance testing for each variable-component loading | ||||
results$loadingplot | Barplot showing loadings with confidence intervals from permutation |
Tables can be converted to data frames with asDF or as.data.frame. For example:
results$results$asDF
as.data.frame(results$results)
Details
Instead of arbitrary cutoffs (e.g., |loading| > 0.5), this test provides objective, hypothesis-tested thresholds for each variable on each component. Procrustes rotation is applied to handle sign reflection and component indeterminacy issues.
References
Linting M, van Os BJ, Meulman JJ. (2011). Statistical Significance of the Contribution of Variables to the PCA solution: An Alternative Permutation Strategy. Psychometrika, 76(3):440-460.
Torres-Espin A, Chou A, Huie JR, et al. (2021). Reproducible analysis of disease space via principal components using the novel R package syndRomics. eLife, 10:e61812.