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 non-redundancy (feasibility) violation matrix and the total solver runtime.

Usage

# S3 method for class 'mspca'
summary(object, C = NULL, feasibilityConstraintType = NULL, 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. mspca() stores every figure this method reports, so C is ignored for objects that carry those stored diagnostics; it is needed only to summarize an object that does not. It will be removed in a future release.

feasibilityConstraintType

(optional) An integer or NULL. Type of constraint used to compute the violations reported in the summary. 0 for orthogonality; 1 for zero pairwise correlation. Must be exactly 0 or 1; fractional values are rejected rather than rounded. When NULL (the default) the type stored in object at fit time is used.

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, cumulative_fve, and max_violation (the largest violation of that PC against any other PC).

feasibility_mat

r x r matrix of pairwise violations (\(|u_i^\top u_j|\) or \(|u_i^\top \Sigma u_j| \big/ \mathrm{tr}(\Sigma)\)). Diagonal and lower triangle are NA.

feasibility

Scalar total violation (sum of the upper triangle of feasibility_mat). Strictly off-diagonal, and therefore not comparable with object$feasibility_violation; see mspca().

feasibility_perPC

Named vector of per-PC maximum violations.

feasibilityConstraintType

The constraint type the reported violations refer to.

fittedConstraintType

The constraint type enforced at fit time, or NA for objects that do not record it.

runtime

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

r

Number of sparse PCs.

inputType

"Sigma" or "X".

Details

The violations are reported under the constraint type that was actually enforced when the object was fitted, which mspca() records in object$feasibilityConstraintType. The printed output always names the definition in use. Passing feasibilityConstraintType explicitly overrides this in order to inspect the solution under the other definition; a warning is emitted when the requested type differs from the fitted one, since the resulting figure does not describe a constraint the solver enforced.

See also

mspca() for the stored nonredundancy matrices.

Examples

TestMat <- cor(mtcars)
res <- mspca(TestMat, r = 2, ks = c(4, 4), verbose = FALSE)
summary(res)
#> 
#> msPCA summary: 2 sparse PC(s)
#> Input type   : Sigma 
#> Runtime (s)  : 0.006 
#> Constraint   : orthogonality (as fitted) 
#> 
#> Per-component statistics:
#>   PC nonzero variance       fve cumulative_fve max_violation
#>  PC1       4 3.570419 0.3245835      0.3245835             0
#>  PC2       4 3.077834 0.2798031      0.6043866             0
#> 
#> Pairwise orthogonality violations (upper triangle):
#>     PC1 PC2
#> PC1   .   0
#> PC2   .   .
#> Total: 0e+00 
#> Violations under the other definition are stored in `$nonredundancy$uncorrelatedness`.

# Fitting under uncorrelatedness: the summary follows the fit automatically.
res_u <- mspca(TestMat, r = 2, ks = c(4, 4),
               feasibilityConstraintType = 1, verbose = FALSE)
summary(res_u)
#> 
#> msPCA summary: 2 sparse PC(s)
#> Input type   : Sigma 
#> Runtime (s)  : 0.127 
#> Constraint   : uncorrelatedness (as fitted) 
#> 
#> Per-component statistics:
#>   PC nonzero variance       fve cumulative_fve max_violation
#>  PC1       4 2.705895 0.2459905      0.2459905  9.559822e-05
#>  PC2       4 2.525243 0.2295676      0.4755581  9.559822e-05
#> 
#> Pairwise uncorrelatedness violations (upper triangle):
#>     PC1          PC2
#> PC1   . 9.559822e-05
#> PC2   .            .
#> Total: 9.559822e-05 
#> Violations under the other definition are stored in `$nonredundancy$orthogonality`.

# The other set of scores is stored too, and needs no refit:
res_u$nonredundancy$orthogonality
#>     PC1 PC2
#> PC1  NA   0
#> PC2  NA  NA