flury.phi | R Documentation |
Calculates phi measure of goodness of diagonalisation as proposed by Flury (1988).
flury.phi(datamat)
datamat |
A square symmetric matrix. |
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.
Returns the value (scalar) of the phi measure for the matrix.
Theo Pepler
Flury, B. (1988). Common Principal Components and Related Multivariate Models. Wiley.
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.