flury.phi: Flury's phi measure

View source: R/flury.phi.R

flury.phiR Documentation

Flury's phi measure

Description

Calculates phi measure of goodness of diagonalisation as proposed by Flury (1988).

Usage

flury.phi(datamat)

Arguments

datamat

A square symmetric matrix.

Details

A smaller phi value points to better diagonalisation, and a larger value to worse diagonalisation. Phi can be a minimum of one, if datamat is perfectly diagonal.

Value

Returns the value (scalar) of the phi measure for the matrix.

Author(s)

Theo Pepler

References

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

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))

# Estimate the eigenvector matrices under the CPC(1) model
Bmats <- B.partial(covmats = S, nvec = nvec, q = 1)

# Check the goodness of diagonalisation for the versicolor
# sample covariance matrix
S1.diag <- t(Bmats[, , 1]) %*% S[, , 1] %*% Bmats[, , 1]
flury.phi(S1.diag)

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