# [Eeglablist] why is the result of coherence not between 0~1? (2)

wu xiang rwfwu at ustc.edu
Sun Sep 25 08:44:22 PDT 2005

```Dear all:

I have asked the question in a previous letter (attached below)and still
coherence(ev-coherence) in eeglab is similar to the tratitional
coherence and the value of ev-coherence is between -1~1
(abs(ev-coherence) is between 0~1).

I find that:
eeglab dose not average(or mean) cross power spectra and power spectra.
eeglab just sum them.

I have tested that, if in step 3 (see previous letter below) I don't
divided by n, then the results would be between 0~1.

But, in fact, the definition of ev-coherence in eeglab (see
timefdetails.m) is also mean rather than sum.(why in realization,it is sum?)

Therefore, I'm confounded by the definition and calculation of coherence
or ev-coherence. I hope someone could explain that.

Thanks.

|----------------- previous letter --------------------------------
I have write a script to caululate coherence (not the event related
coherence of eeglab) according to some papers (e.g. Sarnthein, J.
Synchronization between prefrontal and posterior association cortex
during human working memory. pnas, 95,12,0792-7096,1998). But the result
is not between 0~1. So I ask here.

The following is the simple discription of coherence:
Coherence is the frequency domain equivalent to the cross-covariance
function, which measure the similarity of two signals in frequency domain.

The folowing is the simple discription of calculation of coherence:
For signals x(i),y(i)from two electrodes, i=1:n trials.
%----------------------------
step 1: Every single trials are fourier transformed, X(i) = fft( x(i) ),
Y(i) = fft( y(i) ).
step 2: cross power spectra Sxy(i) = X(i) .* conj( Y(i) ).
(auto) power spectra Sxx(i) = X(i) .* conj( X(i) ), and Syy(i) = Y(i) .*
conj( Y(i) )
step 3: average cross power spectra and power spectra across trials
AvSxy = ( Sxy(1) + ... Sxy(i) + ... Sxy(n) ) / n
AvSxx = ( Sxx(1) + ... Sxx(i) + ... Sxx(n) ) / n
AvSyy = ( Syy(1) + ... Syy(i) + ... Syy(n) ) / n
step 4: coherence Cxy = abs(AvSxy).^2 / (AvSxx .* AvSyy)
%-----------------------------

But the result is not between 0~1.
It's interesting that for every single trials, the coherence is between
0~1. for example:
abs(Sxy(i)).^2 / (Sxx(i) .* Syy(i)). Sure, average such "single trial
coherence" across trial will results in 0~1, while it is different from
the method discribed above -- in which, the cross power spectra and
power spectra are averaged first(see step 3).

Could some one tell me what's wrong?
|------------------------ end previous letter ------------------------

--
wu xiang
Cognitive neuroscience lab of life school of university of science and
technology of china
Hefei, anhui, P.R.China. 230027
web-page:http://202.38.64.10/~rwfwu
You can mail to: rwfwu at ustc.edu or rwfwuwx at gmail.com

```