computeResidualMatrix | R Documentation |
Utility function for computing the residual matrix formed by
subtracting from X
a reduced rank approximation of matrix X
generated from
the top k principal components contained in matrix V
.
computeResidualMatrix(X,V,center=TRUE)
X |
An n-by-p data matrix whose top k principal components are contained in the p-by-k matrix |
V |
A p-by-k matrix containing the loadings for the top k principal components of |
center |
If true (the default), |
Residual matrix.
set.seed(1) # Simulate 10x5 MVN data matrix X=matrix(rnorm(50), nrow=10) # Perform PCA prcomp.out = prcomp(X) # Get rank 2 residual matrix computeResidualMatrix(X=X, V=prcomp.out$rotation[,1:2])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.