calculateLoadingsContribution: Calculate the contribution of PCA loadings to the selected...

View source: R/analysis_dimReduction_pca.R

calculateLoadingsContributionR Documentation

Calculate the contribution of PCA loadings to the selected principal components

Description

Total contribution of a variable is calculated as per ((Cx * Ex) + (Cy * Ey))/(Ex + Ey), where:

  • Cx and Cy are the contributions of a variable to principal components x and y

  • Ex and Ey are the eigenvalues of principal components x and y

Usage

calculateLoadingsContribution(pca, pcX = 1, pcY = 2)

Arguments

pca

prcomp object

pcX

Character: name of the X axis of interest from the PCA

pcY

Character: name of the Y axis of interest from the PCA

Value

Data frame containing the correlation between variables and selected principal components and the contribution of variables to the selected principal components (both individual and total contribution)

Source

http://www.sthda.com/english/articles/31-principal-component-methods-in-r-practical-guide/112-pca-principal-component-analysis-essentials/

See Also

Other functions to analyse principal components: performPCA(), plotPCA(), plotPCAvariance()

Examples

pca <- performPCA(USArrests)
calculateLoadingsContribution(pca)

nuno-agostinho/psichomics documentation built on Feb. 11, 2024, 11:16 p.m.