findcpc: Find common principal components

View source: R/findcpc.R

findcpcR Documentation

Find common principal components

Description

Provides descriptive measures to decide whether there are common eigenvectors in several covariance matrices.

Usage

findcpc(covmats, B = NULL, cutoff = 0.95, plotting = TRUE, main = "Vector correlations for the permutations")

Arguments

covmats

Array of covariance matrices of the k groups.

B

Modal matrix p x p matrix diagonalising the k covariance matrices simultaneously, estimated under the assumption of common eigenvectors in the groups. Can be estimated using simultaneous diagonalisation algorithms such as the Flury-Gautschi (implemented in FG or the stepwise CPC (implemented in stepwisecpc) algorithms.

cutoff

Cut-off value to use in the vector correlation scree plot.

plotting

Logical, indicating whether a scree plot of the vector correlations should be constructed (default = TRUE).

main

Title of the scree plot, if plotting = TRUE.

Details

Identifies possibly common eigenvectors in k data groups by investigating the vectors correlations of all combinations of eigenvectors from the groups. These sets may be tested further for commonness.

Value

Produces a scree plot of the vector correlations (if plotting = TRUE) and returns a list with the values:

all.correlations

Summary of all eigenvector combinations from the k groups, and the geometric means of the vector correlations.

commonvec.order

Order of the (possibly) common eigenvectors in the modal matrix (if an estimate was supplied).

Author(s)

Theo Pepler

References

Pepler, P.T. (2014). The identification and application of common principal components. PhD dissertation in the Department of Statistics and Actuarial Science, Stellenbosch University.

See Also

ensemble.test, flury.test

Examples

# Versicolor and virginica groups of the Iris data
data(iris)
versicolor <- iris[51:100, 1:4]
virginica <- iris[101:150, 1:4]

# Create array containing the two covariance matrices
S <- array(NA, c(4, 4, 2))
S[, , 1] <- cov(versicolor)
S[, , 2] <- cov(virginica)

findcpc(covmats = S)

# Estimate the modal matrix with the FG algorithm
nvec <- c(nrow(versicolor), nrow(virginica))
B <- cpc::FG(covmats = S, nvec = nvec)$B
findcpc(covmats = S, B = B)

tpepler/cpc documentation built on July 7, 2022, 2:13 a.m.