cpcq.test: Likelihood ratio test of partial common principal components...

View source: R/cpcq.test.R

cpcq.testR Documentation

Likelihood ratio test of partial common principal components in the covariance matrices of several groups

Description

Calculates the likelihood ratio statistic and its degrees of freedom for the hypothesis of partially common eigenvectors in the k groups against the alternative of unrelated covariance matrices.

Usage

cpcq.test(covmats, nvec, B = cpc::FG(covmats = covmats, nvec = nvec)$B, q)

Arguments

covmats

Array of covariance matrices.

nvec

Vector of sample sizes of the k groups.

B

Modal matrix simultaneously diagonalising the covariance matrices, estimated under the assumption of common eigenvectors in the k groups. Can be estimated using simultaneous diagonalisation algorithms such as the Flury-Gautschi (implemented in FG or the stepwise CPC (implemented in stepwisecpc) algorithms. NOTE: The q eigenvectors suspected to be common should be arranged in the first q columns of B.

q

Number of common eigenvectors under the null hypothesis.

Value

Returns a list with the following:

chi.square

The likelihood ratio test statistic.

df

Degrees of freedom of the test statistic under the null hypothesis.

covmats.cpcq

Estimated covariance matrices under the null hypothesis model.

Note

This test is based on the assumption that the populations from which the data originated are distributed multivariate normal.

Author(s)

Theo Pepler

References

Flury, B. (1988). Common Principal Components and Related Multivariate Models. Wiley.

See Also

FG, flury.test, equal.test, prop.test and cpc.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)
nvec <- c(nrow(versicolor), nrow(virginica))

# Test to determine whether the first eigenvector estimated with the
# FG algorithm is common to both versicolor and virginica
cpcq.test(covmats = S, nvec = nvec, B = cpc::FG(covmats = S, nvec = nvec)$B, q = 1)

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