# [FieldTrip] Different way of calculating the covariance for LCM

Michael Wibral michael.wibral at web.de
Wed Mar 23 20:27:07 CET 2011

```Dear Fieldtrip users interested in covariance computation,
dear Yuval,

I would like to my opinion on covariance computation up for discussion here.

Covariance is a (bi-)linear measure (like an inner (scalar) product) and should in principle be commutative mathematically with other linear procedures as long as you respect the distributative law from elementary math. Hence,

(1) averaging single trial covariances or computing the covariance of concatenated trials should give the same result if a am not mistaken. In these two approaches samples from your two time course are in the end multiplied with each other one by one. Whichever route of these two you take does not matter at all.
This holds as long as you treat baseline correction and filtering (!) exactly the same way in both cases - otherwise you'll additionally get the baseline covariance over trials as a term in the covariance matrix or filtering related differences. This latter point maybe important if you post hoc decide on a band width to confine your beamformer analysis to and do not go back to the raw data for the band pass filtering.

(2) In contrast, when you compute covariance from a precomputed trial average then every sample at time t in one trial on channel A will in the course of the calculations be implicitely multiplied with samples at time t at EVERY other trial on channel B. So this covariances focuses on covariance structures that are consistent irrespective of the correct pairings of trials.

It's a little bit like first computing the power spectrum and averaging to get total activity (induced+evoked) - this would correspond to procedure (1) , or first averaging and then computing spectral power in order to get the power of evoked activity alone - this would correspond to procedure (2).

This said, when you're interested in the sources of all task related oscillatory activity - not only the activity phase locked to a stimulus you should pick option (1).

Please let me know If I overlooked something important.
Michael

---------------------
Gesendet: Mar 23, 2011 9:42:53 AM
An: "Email discussion list for the FieldTrip project" <fieldtrip at donders.ru.nl>
Betreff: Re: [FieldTrip] Different way of calculating the covariance for LCM

Thanks Yuval,

Le 22/03/11 10:55, Yuval Harpaz a écrit :

So just run the commands on an unaveraged dataset.

Yes but that would be correct if there was only one trial in the     data set (see the message from Luisa).

Another option to consider is the one used by Dr.         Robinson when performing SAMerf (we have his tool [here], works         for our 4D machine).

Thanks for it I will test it.

The idea is to calculate the covariance on all trials, calculate         weights by this covariance (keep filter in LCMV) and then apply         these weights on the averaged data. I found it useful because         the covariance is better for longer datasets, and the averaging         in the end increases the signal to noise ratio. I do not know         exactly how to do it in fieldtrip.

Dear Yuval,

I have to admit that I did not look at the matlab               routines.
In item 2 I suppose that the covariance is calculated for               each trial then averaged. In item 3 I would like to               calculate the covariance from all the signal (the trials               being concatenated).

Jean-Michel

Le 22/03/11 05:47, Yuval Harpaz a écrit :

Dear Jean Michel
As far as I know you can do it on an averaged                         data structure (item 1) or do the same with the                         data structure before averaging (3). I did not                         understand what you meant by 2.

Yuval

Dear                               fieldtrip users,

There are different ways of estimating the                               covariance for LCMV calculation.
If I am correct:

1. As suggested in one of the tutorial one                               can apply the calculation of the                               covariance directly on the average data                               (for the different periods of interest                               that are at least a base line and the                               period of interest).

2. Estimate the covariance from the                               average of the covariance rather than the                               covariance of the average using                               cfg.keeptrials = "yes"

3. Estimate the covariance from the whole                               trials concatenated together.
Is there an easy way to do that in                               fieldtrip (beside create a new data set of                               one trial constituted of all the trials)?

Thanks

Jean-Michel

Laboratoire de                                         MagnétoEncéphaloGraphie INSERM U751. Aix                                         Marseille Université 33 (0)4 91 38 55 62  [jean-michel.badier at univmed.fr]
Service de                                               Neurophysiologie Clinique. CHU                                         Timone 264 Rue                                         Saint-Pierre, 13005                                         Marseille-France

_______________________________________________
fieldtrip mailing list
[fieldtrip at donders.ru.nl]
[http://mailman.science.ru.nl/mailman/listinfo/fieldtrip]

--

Y.Harpaz

a link to the BIU MEG lab:
[http://faculty.biu.ac.il/~goldsa/index.html]

" Why, Dan," ask the people in                               Artificial Intelligence, "do you waste                               your time conferring with those                               neuroscientists? They wave their hands                               about information  processing and worry                               about where it happens, and                               which neurotransmitters are  involved, and                               all those boring facts, but they haven't a                               clue about the computational requirements                               of higher cognitive functions."  "Why,"                               ask the neuroscientists, "do you waste                               your time on the fantasies of Artificial                               Intelligence? They just invent                               whatever machinery they want, and say                               unpardonably ignorant things about the                               brain." The  cognitive psychologists,                               meanwhile, are accused of concocting                               models with neither biological                               plausibility nor proven computational                               powers; the anthropologists wouldn't know                               a model if they saw one, and the                               philosophers, as we all know, just take in                               each other's laundry, warning about                               confusions they themselves have created,                               in an arena bereft of both data and                               empirically testable theories. With                               so many idiots working on the problem, no                               wonder consciousness is still a mystery. Philosopher Daniel Dennet, consciousness                                 explained, pp. 225

_______________________________________________ fieldtrip mailing list [fieldtrip at donders.ru.nl] [http://mailman.science.ru.nl/mailman/listinfo/fieldtrip]

_______________________________________________
fieldtrip mailing list
[fieldtrip at donders.ru.nl]
[http://mailman.science.ru.nl/mailman/listinfo/fieldtrip]

--

Y.Harpaz

a link to the BIU MEG lab:
[http://faculty.biu.ac.il/~goldsa/index.html]

" Why, Dan," ask the people in Artificial               Intelligence, "do you waste your time conferring with               those neuroscientists? They wave their hands about               information  processing and worry about where it happens,               and which neurotransmitters are  involved, and all those               boring facts, but they haven't a clue about the               computational requirements of higher cognitive functions."                "Why," ask the neuroscientists, "do you waste your               time on the fantasies of Artificial Intelligence? They               just invent whatever machinery they want, and say               unpardonably ignorant things about the brain." The                cognitive psychologists, meanwhile, are accused               of concocting models with neither biological plausibility               nor proven computational powers; the anthropologists               wouldn't know a model if they saw one, and the               philosophers, as we all know, just take in each               other's laundry, warning about confusions they themselves               have created, in an arena bereft of both data and               empirically testable theories. With so many idiots working               on the problem, no wonder consciousness is still a               mystery. Philosopher Daniel Dennet, consciousness                 explained, pp. 225

_______________________________________________ fieldtrip mailing list [fieldtrip at donders.ru.nl] [http://mailman.science.ru.nl/mailman/listinfo/fieldtrip]

--

<!--
@page { size: 21cm 29.7cm; margin: 2cm }
P { margin-bottom: 0.21cm }
-->

Laboratoire               de MagnétoEncéphaloGraphie
INSERM               U751. Aix Marseille Université
33               (0)4 91 38 55 62

Service                     de Neurophysiologie Clinique. CHU               Timone
264               Rue Saint-Pierre, 13005 Marseille-France

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Michael Wibral.vcf
Type: text/x-vcard
Size: 637 bytes
Desc: not available
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20110323/2a4324fb/attachment-0002.vcf>
```