Thursday, June 08, 2006

Khatri's test for the reality of complex Wishart variable

Khatri (1965) derived the likelihood ratio test statistic and its distribution, to test for the reality of a covariance matrix in a certain complex Gaussian distribution. This test can be quite useful for testing for functional connectivity on the basis of EEG/MEG data. I presented a poster on the subject on the 12th Annual Meeting of the Organization for Human Brain Mapping in Florence, 2006. The R source code promised in my poster can be downloaded here. It's use is as simple as all null hypothesis tests in R:
# source the script:
source(file=file.choose()) # locate and choose the file 'pkhatri.R'

# generate complex Gaussian covariance matrix
n = 100 # number of observations
m = 8 # number of variables
Y = matrix(rnorm(n*m),ncol=m) + 1i*matrix(rnorm(n*m),ncol=m)
Sk = ccov(Y) # ccov is also defined in 'pkhatri.R'

real.test(Sk, n)
For large dimensions of Sk you can provide p.value=FALSE argument to real.test to supress computation of the p-value. Other functions defined in 'pkhatri.R' are:
  • dkhatri the density function of Khatri's LRT.
  • pkhatri the (cumulative) distribution function of Khatri's LRT.
  • qkhatri the quantile (inverse cumulative distribution) function of Khatri's LRT.
  • rkhatri generates samples from the LRT.
These functions by default pertain to Khatri's statistic Λ = |Sk|/|Re(Sk)|, where |.| denotes determinant and Re(.) the real part. For large m and/or n, it is better to use -log(Λ); this can be done by providing the nlog=TRUE argument to each of these functions.

0 Comments:

Post a Comment

<< Home