Given a random Wishart matrix, B, from W_p(Sigma, df) and independent random vector a, then (a' B a) / (a' Sigma a) is chi-squared with df degrees of freedom.

wishartTest(WishMat, Sigma, vec = NULL)

Arguments

WishMat

random Wishart Matrix from W_p(Sigma, df)

Sigma

Covariance matrix for W_p(Sigma, df)

vec

independent random vector

Value

A chi-squared random variable with df degrees of freedom.

Examples

wishartTest(rWishart(1, 5, diag(1, 20), simplify = FALSE)[[1]], diag(1, 20))
#> [,1] #> [1,] 1.652047