one_covar_matrix_test: Test for Sigma in a Np(mu, Sigma)

View source: R/one_covar_matrix_test.R

one_covar_matrix_testR Documentation

Test for \Sigma in a Np(\mu, \Sigma)

Description

This function can be used to test H_0: \Sigma = \Sigma_0 versus H_1: \Sigma not = \Sigma_0.

Usage

one_covar_matrix_test(Sigma0, S, n, method = "lrt")

Arguments

Sigma0

a matrix indicating the hypothesized value of the covariance matrix \Sigma.

S

a matrix with sample variances and covariances.

n

sample size.

method

a character string specifying the method, it must be one of "lrt" (default), "modlrt1" (modified LRT test) or "modlrt2" (modified LRT test for moderate "n"). You can specify just the initial letter. See details.

Details

When method="lrt" (default) the function performs the LRT test given in Mardia et. al (1979), page 126, expression 5.2.7. For method="modlrt1" or method="modlrt2" the function performs the LRT test given in Rencher and Christensen (2012), page 260, expressions 7.2 and 7.4.

Value

A list with class "htest" containing the following components:

statistic

the value of the statistic.

parameter

the degrees of freedom for the test.

p.value

the p-value for the test.

estimate

the estimated covariance matrix S.

method

a character string indicating the type of test performed.

Author(s)

Freddy Hernandez

See Also

one_mean_vector_test for test \mu in a Np(\mu, \Sigma).

Examples

# Example 5.3.2 from Mardia (1979) page 127
# Test H0: Sigma = diag(100, 100) versus H1: Sigma != diag(100, 100)

Sigma0 <- matrix(c(100, 0, 0, 100), ncol=2)
S <- matrix(c(91.481, 66.875, 66.875, 96.775), ncol=2)

res1 <- one_covar_matrix_test(Sigma0=Sigma0, S=S, n=25, method='lrt')
res1
plot(res1, from=12, to=20, shade.col='dodgerblue2')

# Example from Morrison (1990) page 293
# Test H0: Sigma = Sigma0 versus H1: Sigma != Sigma0
# using the modified LRT test versions

n <- 20

Sigma0 <- matrix(c(4, 3, 2,
                   3, 6, 5,
                   2, 5, 10), ncol=3)

S <- matrix(c(3.42, 2.60, 1.89,
              2.60, 8.00, 6.51,
              1.89, 6.51, 9.62), ncol=3)

res2 <- one_covar_matrix_test(Sigma0=Sigma0, S=S, n=n, method='modlrt1')
res2
plot(res2, from=0, to=20, shade.col='indianred1')

res3 <- one_covar_matrix_test(Sigma0=Sigma0, S=S, n=n, method='modlrt2')
res3
plot(res3, from=0, to=20, shade.col='aquamarine3')


fhernanb/stests documentation built on March 29, 2025, 10:36 a.m.