Evaluate performance of PC estimates compared to true PC values
References
Li, Z., Meisner, J., & Albrechtsen, A. (2023). Fast and accurate out-of-core PCA framework for large scale biobank data. Genome Research, 33(9), 1599-1608. doi:10.1101/gr.277525.122 .
Examples
hilbert <- function(n) { i <- 1:n; 1 / outer(i - 1, i, `+`) }
X <- hilbert(9)[, 1:6]
k <- 4
# Compute SVD using two methods
dcmp1 <- svd(X, k, k)
dcmp2 <- dashSVD( X, k=k)
# Mean variance explained is 1
perfMetric(dcmp1$u, dcmp2$u, metric = "MEV")
#> [1] 1
# minimum of sum of squared errors zero
perfMetric(dcmp1$u, dcmp2$u, metric = "minSSE")
#> [1] 1.100796e-12