DSPRelated.com
Forums

Coherence and Cross Correlation

Started by ayeriera March 14, 2012
Dear all,

I have a simple question that I am trying to confirm, but could not find
any clear answer yet.

If I want to compute the coherence of two signals (EEG signals in my case)
in a particular band (say between 10-13 Hz), is it true that I can do the
following?

1) Apply a band-pass filter between 10 and 13 Hz on both signals
2) Compute the cross correlation between both band-pass filtered signals

From my understanding that should be correct, but I would be very grateful
if somebody can confirm or provide any reference to confirmation the
previous assumption.

Thanks!


ayeriera <ayeriera@n_o_s_p_a_m.gmail.com> wrote:

> I have a simple question that I am trying to confirm, but could not find > any clear answer yet.
> If I want to compute the coherence of two signals (EEG signals in my case) > in a particular band (say between 10-13 Hz), is it true that I can do the > following?
> 1) Apply a band-pass filter between 10 and 13 Hz on both signals > 2) Compute the cross correlation between both band-pass filtered signals
(snip) I will see what others say, but it sounds fine to me. The think is, it really depends on what you want it to do. That is, why you want to compute the cross correlation. -- glen
On 3/14/12 8:20 PM, glen herrmannsfeldt wrote:
> ayeriera<ayeriera@n_o_s_p_a_m.gmail.com> wrote: > >> I have a simple question that I am trying to confirm, but could not find >> any clear answer yet. > >> If I want to compute the coherence of two signals (EEG signals in my case) >> in a particular band (say between 10-13 Hz), is it true that I can do the >> following? > >> 1) Apply a band-pass filter between 10 and 13 Hz on both signals >> 2) Compute the cross correlation between both band-pass filtered signals > > (snip) > > I will see what others say, but it sounds fine to me. > > The think is, it really depends on what you want it to do. > That is, why you want to compute the cross correlation. >
i presume to measure the "coherence" between the two signals. (assuming he normalizes it, and then i thought they called it "co-variance" or something like that.) my question is why BPF the thing? -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
robert bristow-johnson <rbj@audioimagination.com> wrote:

(snip, I wrote)
>> The think is, it really depends on what you want it to do. >> That is, why you want to compute the cross correlation.
> i presume to measure the "coherence" between the two signals. (assuming > he normalizes it, and then i thought they called it "co-variance" or > something like that.)
Yes, but why do you want the coherence. (Or, more usually, the coherence length or coherence time.) Usually not just because, but so that it is long enough for something to work. For holography, the coherence length depends on things like the size of the object.
> my question is why BPF the thing?
Yes, that too. -- glen
On 3/14/12 11:26 PM, glen herrmannsfeldt wrote:
> robert bristow-johnson<rbj@audioimagination.com> wrote: > > (snip, I wrote) >>> The think is, it really depends on what you want it to do. >>> That is, why you want to compute the cross correlation. > >> i presume to measure the "coherence" between the two signals. (assuming >> he normalizes it, and then i thought they called it "co-variance" or >> something like that.) > > Yes, but why do you want the coherence. (Or, more usually, > the coherence length or coherence time.)
usually it's because the "two" signals have a common root or source. the OP says his two signals are from an EEG. i don't imagine that they are from the EEGs of two different people taken at two different settings. i think that when they wire you up for an EEG, there are many electrodes connected at various places on your chest and back. so these different EEG signals will likely have "events" that are a consequence of the same root event but there are different delays. finding the maximum cross-correlation value between probes placed at different places will tell you something about the different signal propagation and maybe about the different tissue as a medium. or maybe one EEG is indicative of one muscle action and another is from another. but, based on a single trigger event, it might be interesting to see how well correlated the latter action is to the former. maybe when there is fibrillation this correlation gets wackier and less. i dunno, ask the cardiologists.
> > Usually not just because, but so that it is long enough > for something to work. For holography, the coherence length > depends on things like the size of the object. > >> my question is why BPF the thing? > > Yes, that too.
we'll wait for what the OP might say. if the two BPFs are absolutely identical, it should not hurt or skew the correlation. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
ayeriera <ayeriera@n_o_s_p_a_m.gmail.com> wrote:
> I have a simple question that I am trying to confirm, but could not find > any clear answer yet. > If I want to compute the coherence of two signals (EEG signals in my case) > in a particular band (say between 10-13 Hz), is it true that I can do the > following? > 1) Apply a band-pass filter between 10 and 13 Hz on both signals > 2) Compute the cross correlation between both band-pass filtered signals
In "The Analysis of Time Series: An Introduction" by Chatfield (1980), he defines (p. 177) the (squared) coherency C(omega) in terms of various parameters and then proceeds to write: "It can be shown that: 0 <= C(omega) <= 1 This quality measures the linear correlation between the two components of the bivariate process at frequency omega and is analagous to the square of the usual cross correlation coefficient. The closer C(omega) is to one, the more closely related are the two processes at frequency omega." Googling coherence also yields a number of hits, such as: http://www.dsprelated.com/dspbooks/mdft/Coherence_Function.html You might also search comp.dsp. The question has come up before, using EEG as an example. So I think you're on the right track, but you'll have to be careful of the definitions, the calculations and the usual circular/linear concerns to make sure you're getting the right numbers. Like everyone else, I'm not quite sure what to make about that bandpass part. Kevin McGee
On Mar 15, 9:57&#4294967295;am, "ayeriera" <ayeriera@n_o_s_p_a_m.gmail.com> wrote:
> Dear all, > > I have a simple question that I am trying to confirm, but could not find > any clear answer yet. > > If I want to compute the coherence of two signals (EEG signals in my case) > in a particular band (say between 10-13 Hz), is it true that I can do the > following? > > 1) Apply a band-pass filter between 10 and 13 Hz on both signals > 2) Compute the cross correlation between both band-pass filtered signals > > From my understanding that should be correct, but I would be very grateful > if somebody can confirm or provide any reference to confirmation the > previous assumption. > > Thanks!
Do you mean the magnitude squared coherence? There is a formula for this based on the FFT, cross spectra etc. Easy to find on the net. Value varies from 0 to 1and is a bit like correlation but against frequency. http://www.mathworks.com/help/toolbox/signal/ref/mscohere.html
Dear all

Thanks for your kind replies. I will try to be more specific about my
question and my example:

I have an EEG (brain electrical activity) recorded with 2 channels (x and
y) placed in the scalp of a subject. Both recording are measured at the
same time.

I want to compute the coherence between both channels, using this formula
(I know there are several definition for coherence and so on...)

 Cxy=|Sxy|^2/(Sxx.Syy)

Where Sxx and Syy are the auto-spectra of x and y respectively and Sxy is
the cross-spectra between x and y.

If I want to know the Coherence for a specific band (i.e. the famous alpha
band in EEG data analysis that goes from 8-12 Hz), I can integrate Cxy
between 8 and 12 Hz.

My question is, if I apply the same band-pass filter (from 8 and 12 Hz) to
both signals (x and y) and then compute the cross correlation of the
filtered x and y signals, would that be mathematically equivalent to
computing the coherence as explained in the previos paragraph?
Dear all

Thanks for your kind replies. I will try to be more specific about my
question and my example:

I have an EEG (brain electrical activity) recorded with 2 channels (x and
y) placed in the scalp of a subject. Both recording are measured at the
same time.

I want to compute the coherence between both channels, using this formula
(I know there are several definition for coherence and so on...)

 Cxy=|Sxy|^2/(Sxx.Syy)

Where Sxx and Syy are the auto-spectra of x and y respectively and Sxy is
the cross-spectra between x and y.

If I want to know the Coherence for a specific band (i.e. the famous alpha
band in EEG data analysis that goes from 8-12 Hz), I can integrate Cxy
between 8 and 12 Hz.

My question is, if I apply the same band-pass filter (from 8 and 12 Hz) to
both signals (x and y) and then compute the cross correlation of the
filtered x and y signals, would that be mathematically equivalent to
computing the coherence as explained in the previos paragraph?
On 3/15/12 4:54 AM, ayeriera wrote:
> Dear all > > Thanks for your kind replies. I will try to be more specific about my > question and my example: > > I have an EEG (brain electrical activity)
duh, it's E***E***G, not E***C***G. sorry.
> recorded with 2 channels (x and y) placed in the scalp of a subject.
> Both recording are measured at the same time.
> > I want to compute the coherence between both channels, using this formula > (I know there are several definition for coherence and so on...) > > Cxy=|Sxy|^2/(Sxx.Syy) > > Where Sxx and Syy are the auto-spectra of x and y respectively and Sxy is > the cross-spectra between x and y.
i think you have the squares and implicit square roots off a bit. should be: Cxy = Sxy/sqrt(Sxx*Syy)
> If I want to know the Coherence for a specific band (i.e. the famous alpha > band in EEG data analysis that goes from 8-12 Hz), I can integrate Cxy > between 8 and 12 Hz. > > My question is, if I apply the same band-pass filter (from 8 and 12 Hz) to > both signals (x and y) and then compute the cross correlation of the > filtered x and y signals, would that be mathematically equivalent to > computing the coherence as explained in the previous paragraph?
well, yes, except it's the coherence of only the component between 8 and 12 Hz. use the same BPF for Sxx and Syy that you use for Sxy and use the same window. essentially Sxx and Syy are calculated exactly the same as Sxy except you're putting x and x (or y and y) into the filtering and correlation alg that you put in x and y. x[n] -------------->[BPF]----->[window]------. | v (x)---->[mean]---> Sxy ^ | y[n] ---->[lag]---->[BPF]----->[window]------' except if you decide to put in a lag for Sxy, do not put in any lag for Sxx or Syy, those should remain constant. maybe put in +lag/2 in one leg and -lag/2 in the other leg. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."