pca_loading: Principal component loading

View source: R/pca_loading.R

pca_loadingR Documentation

Principal component loading

Description

This function computes principal component (PC) loading from the result of the "prcomp" function. (The "princomp" function is not supported. For "princomp" function, the "loadings" function in stats package should be used.) In this function, data matrix is should be scaled to zero mean and unit variance (i.e. autoscaling) for each variables.

Usage

pca_loading(pca)

Arguments

pca

The return object of the "prcomp" function.

Details

The PC loading and the p-value by statistical hypothesis testing is added to the pca object returned by the "prcomp" function.

Value

The return value is a list object that contains the following elements:

R : PC loading (Correlation coefficient between PC score and each variables in data matrix.)

p.value : p-value of PC loading

Author(s)

Hiroyuki Yamamoto

References

Yamamoto H., Fujimori T., Sato H., Ishikawa G., Kami K., Ohashi Y. (2014). "Statistical hypothesis testing of factor loading in principal component analysis and its application to metabolite set enrichment analysis". BMC Bioinformatics, (2014) 15(1):51.

Examples

data(fasting)
X <- fasting$X

pca <- prcomp(X, scale=TRUE)

pca <- pca_loading(pca)
pca$loading$R # PC loading
pca$loading$p.value # p-value

loadings documentation built on May 29, 2024, 8:01 a.m.