spec_pca_wn_contrib {tidyspec} | R Documentation |
Compute Wavenumber Contributions to Principal Components
Description
This function calculates the contribution of each wavenumber to the principal components (PCs) in a PCA result. Contributions are computed as the squared loadings multiplied by 100.
This function calculates the contribution of each wavenumber to the principal components (PCs) in a PCA result. Contributions are computed as the squared loadings multiplied by 100.
Usage
spec_pca_wn_contrib(PCA)
spec_pca_wn_contrib(PCA)
Arguments
PCA |
An object of class 'prcomp', containing the results of a principal component analysis. |
Details
The function extracts the PCA loadings (rotation matrix) and computes the squared values of each loading, scaled to percentage values. This helps interpret the importance of each wavenumber in defining the principal components.
The function extracts the PCA loadings (rotation matrix) and computes the squared values of each loading, scaled to percentage values. This helps interpret the importance of each wavenumber in defining the principal components.
Value
A tibble containing the wavenumber column and the percentage contribution of each wavenumber to each principal component.
A tibble containing the wavenumber column and the percentage contribution of each wavenumber to each principal component.
Examples
pca_result <- spec_pca(CoHAspec)
wn_contrib <- spec_pca_wn_contrib(pca_result)
print(wn_contrib)
pca_result <- spec_pca(CoHAspec)
wn_contrib <- spec_pca_wn_contrib(pca_result)
print(wn_contrib)