Learn R Programming

capr (version 0.2.0)

FG: Flury-Gautschi Common Principal Components

Description

Implements the Flury & Gautschi (1986) (FG) iterative algorithm and a variant to estimate a common loading matrix across multiple covariance matrices. Each iteration cycles over all ordered pairs of variable indices and updates a (2 x 2) rotation so that the transformed matrices share diagonal structure.

Usage

FG(cov_array, p = NULL, m = NULL, maxit = 30L)

FG2(cov_array, p = NULL, m = NULL, maxit = 30L)

Value

A \(p x p\) numeric matrix of estimated common loadings.

Arguments

cov_array

Numeric 3D array of shape \(p x p x m\) containing covariance matrices in its \(m\) slices.

p

Optional integer specifying the matrix dimension; defaults to dim(cov_array)[1].

m

Optional integer specifying the number of matrices/slices; defaults to dim(cov_array)[3].

maxit

Integer scalar; number of outer iterations of the algorithm.

Details

Two solvers are exported:

FG()

The original FG algorithm.

FG2()

An alternative algorithm by Eslami et al. (2013).

References

Flury, B. N. (1984). "Common Principal Components in k Groups." Journal of the American Statistical Association, 79, 892-898.

Flury, B. N., & Gautschi, W. (1986). "An Algorithm for Simultaneous Orthogonal Transformation of Several Positive Definite Symmetric Matrices to Nearly Diagonal Form." SIAM Journal on Scientific and Statistical Computing, 7(1), 169-184.

Eslami, A., Qannari, E. M., Kohler, A., & Bougeard, S. (2013). "General Overview of Methods of Analysis of Multi-Group Datasets." Revue des Nouvelles Technologies de l'Information, 25, 108-123.

Examples

Run this code
set.seed(1)
p <- 3
m <- 4
mats <- replicate(m,
    {
        A <- matrix(rnorm(p * p), p, p)
        crossprod(A)
    },
    simplify = FALSE
)
cov_cube <- array(NA_real_, dim = c(p, p, m))
for (k in 1:m) cov_cube[, , k] <- mats[[k]]
FG(cov_cube, maxit = 5)
FG2(cov_cube, maxit = 5)

Run the code above in your browser using DataLab