lrt.statistic: One-sample likelihood ratio tests

View source: R/lrt_tests.R

lrt.statisticR Documentation

One-sample likelihood ratio tests

Description

The traditional likelihood ratio test statistic for the one-sample hypothesis of covariance matrix.

Usage

lrt.statistic(x, test = "identity")

Arguments

x

data matrix with rows representing samples and columns representing variables

test

The type of test being performed - "identity"(default) or "sphericity".

Value

A list with two values

test.statistic

The test statistic value

p.value

The p-value

References

T. W. Anderson. An introduction to multivariate statistical analysis. Wiley Series in Probability and Statistics, 3rd edition, 2003.

Examples

library(mvtnorm)
# Test for identity
x = rmvnorm(n = 20, mean = numeric(100), sigma = diag(100))
lrt.statistic(x, test = "identity")
# Test for sphericity
y = rmvnorm(n = 10, mean = runif(100, 1, 3), sigma = diag(rgamma(100, 10, 3)))
lrt.statistic(y, test = "sphericity")

dnayyala/cramp documentation built on June 27, 2023, 1:34 p.m.