Calculate the contribution of PCA loadings to the selected principal components
Source:R/analysis_dimReduction_pca.R
calculateLoadingsContribution.Rd
Total contribution of a variable is calculated as per
((Cx * Ex) + (Cy * Ey))/(Ex + Ey)
, where:
Cx
andCy
are the contributions of a variable to principal componentsx
andy
Ex
andEy
are the eigenvalues of principal componentsx
andy
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)
See also
Other functions to analyse principal components:
performPCA()
,
plotPCA()
,
plotPCAvariance()
Examples
pca <- performPCA(USArrests)
calculateLoadingsContribution(pca)
#> Rank Gene PC1 loading PC2 loading Contribution to PC1 (%)
#> Assault 1 Assault 0.99522128 -0.05876003 99.0465399
#> UrbanPop 2 UrbanPop 0.04633575 0.97685748 0.2147001
#> Rape 3 Rape 0.07515550 0.20071807 0.5648349
#> Murder 4 Murder 0.04170432 -0.04482166 0.1739250
#> Contribution to PC2 (%) Contribution to PC1 and PC2 (%)
#> Assault 0.3452741 96.2825574
#> UrbanPop 95.4250536 2.8809248
#> Rape 4.0287742 0.6618374
#> Murder 0.2008981 0.1746804