covariance matrix estimation

Forum for discussion on different brain signals
Posts: 5
Joined: 26 Jan 2011, 06:38

covariance matrix estimation

Post by marohde » 10 Feb 2011, 16:05

Hello everyone,

I ran into problems implementing a CSP filter when I realized that none of the covariance matrices estimated from my data were positive definite (i.e., alwyas one negative eigenvalue). I estimate the covariance R in one trial by

R = (X X')/ trace(X X')

and then average across trials (as recommended here)

As I am a newbie to EEG, I wonder about the most likely cause of this and how to address the problem.

- how many trials with how many data points do you normally need to estimate a covariance matrix? (can this be due to sparse data?)

- can this be due to insufficient artifact removal?

- is this a theoretical problem?

- a technical problem?

- is there a simple way to address this?

thanks a lot!


Posts: 31
Joined: 17 Nov 2009, 15:15

Post by jhill » 10 Feb 2011, 17:47

Large negative or small negative?

It's fairly common for EEG cov matrices to have fairly poor condition, and the last eigenvalue may even be 0 (+/- numerical-precision fuzz) if the EEG data have been expressed relative to a common-average reference or CAR (subtracting the mean-across-channels clearly reduces the channel dimensionality by 1 since one channel is now linearly predictable from the other n-1). Additional eigenvalues may be 0 if you have flat (dead) channels in there. Look at the raw data.

But really negative ? No, covariance matrices are by their nature at least positive-semidefinite for real-valued data. So you may have a flawed covariance estimator on your hands. Maybe check the sanity of R in some other ways: is it [number of channels x number of channels]? Is it symmetric? Is it real-valued? Are there Infs and NaNs anywhere?

Note that the formula you've given for R computes non-central covariance. Unless you already subtracted the mean (for example by high-pass- or band-pass-filtering each channel) which is standard practice for CSP and friends.

Finally, a few seconds of EEG should give you an R that is sane, if not especially robust. A few minutes should give you something fairly stable.

Posts: 5
Joined: 26 Jan 2011, 06:38

Post by marohde » 10 Feb 2011, 21:39

thanks, jhill,
a few seconds of EEG should give you an R that is sane, if not especially robust. A few minutes should give you something fairly stable.
it should be stable enough, in that case (ca. 200x1s)

I didn't realize that CAR means loosing one channel but it makes sense - so maybe i just chuck out the first eigenvector (that has a small negative eigen value < -0.01) out or maybe i do not apply the CAR in the first place. all the trouble probalby results from there then, because otherwise, it's all well-formed, the data is band-pass filtered and all channels give reasonable signals.

well thanks for this very useful advice - this will surely not be the last time i'll post questions wth obvious answers here :)


Who is online

Users browsing this forum: No registered users and 1 guest