stepwisecpc: Stepwise common principal components (CPC)

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/stepwisecpc.R

Description

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

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# 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 Nov. 19, 2017, 1:19 p.m.