pve: Proportion of Variance Explained (PVE)

View source: R/utility.R

pveR Documentation

Proportion of Variance Explained (PVE)

Description

Calculate the Proportion of variance explained by a set of linear transformation, (e.g. eigenvectors).

Usage

pve(x, v, is.cov = FALSE)

Arguments

x

matrix or Matrix, the original data matrix or the Gram matrix.

v

matrix or Matrix, coefficients of linear transformation, e.g., loadings (in PCA).

is.cov

logical, whether the input matrix is a covariance matrix (or a Gram matrix).

Value

a numeric value between 0 and 1, the proportion of total variance in x explained by the PCs whose loadings are in v.

References

Shen, H., & Huang, J. Z. (2008). "Sparse principal component analysis via regularized low rank matrix approximation." Journal of multivariate analysis, 99(6), 1015-1034.

Examples

## use the "swiss" data
## find two sparse PCs
s.sca <- sca(swiss, 2, gamma = sqrt(ncol(swiss)))
ld <- loadings(s.sca)
pve(as.matrix(swiss), ld)

epca documentation built on July 26, 2023, 5:47 p.m.