explainedVar: Variance explained by non orthogonal principal components

View source: R/explainedVar.R

explainedVarR Documentation

Variance explained by non orthogonal principal components

Description

The loadings in sparse and group-sparse PCA are not necessarly orthogonal and new definitions of explained variance must be used. This function implements six different definitions of explained variance: the subspace variance (subspVar), the adjusted variance (adjVar), the optimal projected variance (optVar) the polar variance (polVar), the QR normalized variance (QRnormVar) and the UP normalized variance (UPnormVar).

Usage

explainedVar(B, Z, method = "optVar")

Arguments

B

a numerical data matrix (usually centered and/or scaled, see details).

Z

a numerical loading matrix.

method

the name of the explained variance: "subspVar", "optVar", "polVar", "adjVar","QRnormVar","UPnormVar".

Details

The principal components are defined by Y=BZ where B is the centered and/or scaled data matrix and Z is the sparse loading matrix. The argument B must then be consistent with the pre-processing step in sparsePCA and groupsparsePCA. The loading vectors in Z must be unique norm and linearly independant.

The "adjVar" method is first introduced in Zou et al. (2006), the "subspVar" method is introduced in Shen & Huang (2008) and the "optVar", "QRnormVar" and "UPnormVar" methods are introduced in Chavent & Chavent (2020). The six variance definitions are compared in Chavent & Chavent (2020)

Value

Returns the variance explained by the components.

References

M. Chavent and G. Chavent, Optimal projected variance group-sparse block PCA, submitted, 2020.

H. Zou, T. Hastie, R. Tibshirani. Sparse principal component analysis. Journal of computational and graphical statistics, 15(2):265-286, 2006.

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

See Also

pev, sparsePCA, groupsparsePCA

Examples

# Example from Shen & Huang 2008
 v1 <- c(1,1,1,1,0,0,0,0,0.9,0.9)
 v2 <- c(0,0,0,0,1,1,1,1,-0.3,0.3)
 valp <- c(200,100,50,50,6,5,4,3,2,1)
 A <- simuPCA(50,cbind(v1,v2),valp,seed=1)
 Z <- sparsePCA(A,2,c(0.5,0.5))$Z #deflation
 B <- sparsePCA(A,2,c(0.5,0.5))$B
 namevar <- c("subspVar", "optVar", "polVar", "adjVar","QRnormVar","UPnormVar")
 vectvar <- rep(NA,length(namevar))
 names(vectvar) <- namevar
 for (j in 1:length(namevar)) vectvar[j] <- explainedVar(B,Z,method=namevar[j])
 

chavent/sparsePCA documentation built on Feb. 2, 2023, 1:12 p.m.