| fraction_variance_explained | R Documentation |
Computes the fraction of variance explained (variance explained normalized by the trace of the covariance/correlation matrix) by a set of PCs.
fraction_variance_explained(C, U)
C |
A matrix. The correlation or covariance matrix (p x p). |
U |
A matrix. The matrix containing the r PCs (p x r). |
A float.
library(datasets)
TestMat <- cor(datasets::mtcars)
mspcares <- mspca(TestMat, 2, c(4,4))
fraction_variance_explained(TestMat, mspcares$x_best)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.