stepwisecpc: Stepwise common principal components (CPC)

View source: R/stepwisecpc.R

stepwisecpcR Documentation

Stepwise common principal components (CPC)

Description

Estimates stepwise common principal components to simultaneously diagonalise several covariance matrices.

Usage

stepwisecpc(covmats, nvec)

Arguments

covmats

Array containing the covariance matrices for the groups, created with a command such as covmats <- array(NA, dim = c(p, p, k)), where p refers to the number of rows/columns of each covariance matrix, and k is the number of groups (or covariance matrices).

nvec

Vector containing the sample sizes of the k groups.

Value

Returns a list with the values:

B

Orthogonal matrix containing the estimated common eigenvectors in the columns.

eigenvals

Matrix of which the columns contain the estimated eigenvalues of the k covariance matrices under the CPC model.

Author(s)

Sarel Steel, Theo Pepler

References

Trendafilov, N. T. (2010). Stepwise estimation of common principal components. Computational Statistics and Data Analysis, 54(12): 3446-3457.

See Also

FG

Examples

# Estimate the modal matrix for the versicolor and virginica groups
# under the common eigenvector assumption.

data(iris)
versicolor <- iris[51:100, 1:4]
virginica <- iris[101:150, 1:4]

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

stepwisecpc(covmats = S, nvec = c(nrow(versicolor), nrow(virginica)))

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