0
$\begingroup$

In prcomp library in R for instance, the "empirical" and "theoretical" explained variances for PCA are given by:

res.pca = prcomp(X, center = TRUE)
res.pca$x[,-1] = 0

var.empirical = (1 - sum( (res.pca$x %*% t(res.pca$rotation) - X)**2 ) / sum(X**2))*100
var.theoretical = (1 - (res.pca$sdev[1]**2 / sum(res.pca$sdev**2)))*100

I would like to understand the difference between the two quantities and which one does PCA tries to optimize. Could anyone help me here please?

Ref. https://www.rdocumentation.org/packages/freqdom.fda/versions/0.9.1/topics/fts.dpca

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy