equal.test: Likelihood ratio test of equality of several covariance...

View source: R/equal.test.R

equal.testR Documentation

Likelihood ratio test of equality of several covariance matrices

Description

Calculates the likelihood ratio statistic and its degrees of freedom for the hypothesis of equal covariance matrices against the alternative of unrelated covariance matrices.

Usage

equal.test(covmats, nvec)

Arguments

covmats

Array of covariance matrices.

nvec

Vector of sample sizes of the k groups.

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.equal

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

See Also

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

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

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