Skip to contents

S3 summary method for objects of class "mspca" returned by mspca(). Returns (and prints) a per-PC summary table (number of non-zero loadings, variance explained, FVE, and cumulative FVE) together with the pairwise feasibility violation matrix and the total solver runtime.

Usage

# S3 method for class 'mspca'
summary(object, C = NULL, feasibilityConstraintType = 0L, digits = NULL, ...)

Arguments

object

An object of class "mspca", as returned by mspca().

C

(optional) A numeric matrix (p x p). The covariance or correlation matrix used when fitting. May be omitted for type = "X" results, where the figures are stored inside the object.

feasibilityConstraintType

An integer. Type of constraint used to compute the feasibility violation reported in the summary. 0 (default) for orthogonality; 1 for zero pairwise correlation.

digits

An integer or NULL. Number of significant digits for display. When NULL (the default), getOption("digits") is used.

...

Further arguments required by the summary() generic; not used by this method.

Value

Invisibly returns a list of class "summary.mspca" with fields:

table

Data frame with columns PC, nonzero, variance, fve, and cumulative_fve.

feasibility_mat

r x r matrix of pairwise feasibility violations (\(|u_i^\top u_j|\) or \(|u_i^\top C u_j|\)). Diagonal and lower triangle are NA.

feasibility

Scalar total feasibility violation (sum of the upper triangle of feasibility_mat).

runtime

Solver runtime in seconds (if stored in the object).

r

Number of sparse PCs.

inputType

"Sigma" or "X".

Examples

TestMat <- cor(mtcars)
res <- mspca(TestMat, r = 2, ks = c(4, 4), verbose = FALSE)
summary(res, TestMat)
#> 
#> msPCA summary: 2 sparse PC(s)
#> Input type   : Sigma 
#> Runtime (s)  : 0.021 
#> 
#> Per-component statistics:
#>   PC nonzero variance       fve cumulative_fve
#>  PC1       4 3.547820 0.3225291      0.3225291
#>  PC2       4 3.077834 0.2798031      0.6023322
#> 
#> Pairwise feasibility violations (upper triangle):
#>     PC1 PC2
#> PC1   .   0
#> PC2   .   .
#> Total: 0e+00