flury.test: Flury's tests for common covariance structures

View source: R/flury.test.R

flury.testR Documentation

Flury's tests for common covariance structures

Description

Calculates the AIC and chi square statistics for all the applicable models in Flury's hierarchy of covariance structures for several covariance matrices.

Usage

flury.test(covmats, nvec, B = cpc::FG(covmats = covmats, nvec = nvec)$B, p = dim(covmats)[1], qmax = p - 2, commonvec.order = findcpc(covmats = covmats, B = B, plotting = FALSE)$commonvec.order)

Arguments

covmats

Array of covariance matrices to be tested, created by a command such as covmats <- array(NA, dim = c(p, p, k)).

nvec

Vector of sample sizes of the k groups.

B

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

p

Number of columns/variables in the covariance matrix.

qmax

Maximum number of common eigenvectors for which to estimate the partial CPC model statistics.

commonvec.order

Vector indicating the order of the most likely candidates of common eigenvectors – from 1 (most likely) to p (least likely).

Value

Returns a data frame with the following columns, containing a value for each of the models in Flury's hierarchy:

Model

Name of the model in Flury's hierarchy.

Chi.square

Chi square statistic for the model.

DF

Degrees of freedom associated with the chi square statistic.

Chi2.div.df

The chi square statistic divided by its degrees of freedom.

AIC

Akaike Information Criterion for the model.

No.of.CPCs

Number of common eigenvectors for the model.

Note

Flury (1988) suggested picking the model with the smallest AIC value. Alternatively one may select the model for which the chi square statistic divided by its degrees of freedom is closest to one, although Flury (and others) cautions against this practice as the chi square statistics for the models are probably not independent of one another.

Author(s)

Theo Pepler

References

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

See Also

flury.AIC, equal.test, prop.test, cpc.test and cpcq.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))

flury.test(covmats = S, nvec = nvec)

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