View source: R/one_covar_matrix_test.R
one_covar_matrix_test | R Documentation |
\Sigma
in a Np(\mu, \Sigma)
This function can be used to test H_0: \Sigma = \Sigma_0
versus H_1: \Sigma
not = \Sigma_0
.
one_covar_matrix_test(Sigma0, S, n, method = "lrt")
Sigma0 |
a matrix indicating the hypothesized value of the covariance matrix |
S |
a matrix with sample variances and covariances. |
n |
sample size. |
method |
a character string specifying the method, it must be one of |
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.
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. |
Freddy Hernandez
one_mean_vector_test for test \mu
in a Np(\mu, \Sigma)
.
# 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')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.