Learn R Programming

loadings (version 0.5.1)

pca_loading: 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)

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

Arguments

pca

The return object of the "prcomp" function.

Author

Hiroyuki Yamamoto

Details

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

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

Run this code
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

Run the code above in your browser using DataLab