LawleyTest: Likelihood Ratio Tests for equality of last $n-K$...

Description Usage Arguments Value References Examples

View source: R/alternative.R

Description

The function returns the dimension that minimizes the $p$-value from the likelihood ratio test (LRT) derived by Lawley (1956).

Usage

1
LawleyTest(lambda, M)

Arguments

lambda

a numeric vector of positive sample eigenvalues that sums to $n$

M

a positive integer for the number of observations or features

Value

an integer $K$ between 1 and $n$ that minimizes the LRT $p$-value.

References

Lawley, D. N. (1956) Tests of significance for the latent roots of covariance and correlation matrices. **Biometrika** *43*.1/2: 128-136. <doi:10.2307/2333586>

Examples

1
2
3
4
5
6
7
## Not run: 
library(MASS)
X <- mvrnorm(1000, mu = rep(0,10), Sigma = diag(c(5,4,2,4,1,1,1,1,1,1)))
eigen_values <- eigen(as.matrix(Matrix::nearPD(stats::cov(scale(t(X))))$mat))$val
LawleyTest(lambda = eigen_values)

## End(Not run)

WeiAkaneDeng/SPAC2 documentation built on Jan. 15, 2022, 5:01 a.m.