[FieldTrip] Coherence in FieldTrip and mscohere in Matlab

Andrei Medvedev am236 at georgetown.edu
Thu Mar 28 02:36:09 CET 2013


Dear Clara,

As previously discussed, coherence, indeed, FUNDAMENTALLY requires to be 
calculated over several trials, and this maxim does not depend on the 
way you calculate it. Because, conceptually, coherence is a measure of 
phase STABILITY in time i.e., how much it changes from trial to trial. 
If you have just one trial, you cannot say how stable the phase 
relationship between  two signals is: one trial gives you just one 
measurement of phase difference (at least, if you use a window-based 
spectral analysis such as FFT, wavelet, tapers etc; the alternative 
methods based on instantaneous phase such as Hilbert transform are 
beyond this discussion at this point). And this is why your manual 
estimate of coherence on a single trial gives you 1: it should be this 
way because the cross-spectrum over one trial normalized by the 
auto-spectra of two signals IDENTICALLY equals 1 (you can simply check 
it with the formula).

Why then does the Matlab mscohere give you values less than 1 even for 
one trial? It is just because all Matlab spectral functions split your 
one trial into several sub-segments BY DEFAULT. To check this, you need 
to take a full control of mscohere (not to use the default values) and 
explicitly say what windows to use.

As an example, you can take two random variables x and y 1000 points 
long assuming fsample=1000 (1 sec trial). Then calculate coh by two 
different calls of mscohere:

1) Coh = mscohere(x,y,1000,0,1000,1000); - forcefully take the whole 
trial without splitting it into smaller parts by default;

2) Coh = mscohere(x,y,500,0,500,1000); - splitting this one trial into 
two sub-trials 500 points each without overlap.

And see what happens.

Best,
Andrei.


On 3/27/2013 3:30 PM, Clara A. Scholl wrote:
> Dear FieldTrip Community,
>
> I'd like to better understand the requirement that the calculation of
> coherence be averaged over>  1 trials, a topic previously discussed on
> the FieldTrip discussion site (e.g.
> http://mailman.science.ru.nl/pipermail/fieldtrip/2012-November/005923.html).
>
> I worked through the calculation of coherence for n=1 trials at two
> distinct channels manually (dividing the cross-spectrum by the mean of
> the power spectra), and indeed the value resolves to 1 as others have
> previously said it would (where the power spectra and cross spectrum
> were estimated with the multitaper method).  However, I'm still
> confused because the Matlab function mscohere returns coherence values
> between 0 and 1 (less than 1) at each calculated frequency for an
> input of two single time series X and Y, e.g. two single time courses
> (from the same trial) at two distinct channels.
>
> I suspect this may be related to the method for estimating the
> power/cross spectral density in mscohere (Welch's averaged modified
> periodogram method) because if I estimate the cross-spectrum and power
> spectra in FieldTrip with cfg.method = 'mtmwelch_old' (a deprecated
> option), then the coherence estimates are between 0 and 1 (not 1).
> Can someone please help me to understand this -- why would coherence
> be 1 using the multitaper method but not using Welch's method?
>
> I'd like to understand if coherence is fundamentally required to be
> estimated over multiple trials (at two distinct channels), or if the
> requirement for multiple trials is related to the method of
> calculating the spectra, and if so why that is the case.
>
> Thanks immensely,
> Clara
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip




More information about the fieldtrip mailing list