timelockstatistics

Robert Oostenveld r.oostenveld at FCDONDERS.RU.NL
Tue Mar 24 14:55:45 CET 2009


Hi Christine

With timelockstatsistics you can only test the exchangeability for  
data points that can be exchanged one-to-one. The data is usually  
arranged in a Ntrials*Nchans*Ntime matrix and you should have such a  
matrix both for the baseline and activation window.

You should prepare your data in such a way that the channels (of  
course) but also that the timepoints match. The underlying function  
will make the data selection based on the overlap bwteen the two input  
datasets that you hand over to timelockstatistics. So if you want to  
compare paired data, also the time-axis of the two datasets should be  
the same. Resegmenting the data can be done using redefinetrial, i.e.

cfg = []
cfg.toilim = [0.050 0.400];
dataA = redefinetrial(cfg, data_org)
cfg.toilim = [-0.400 -0.050];
dataB = redefinetrial(cfg, data_org)

Subsequently you can assign the same time axis to both, either by  
shifting the time-axis of each trial
   for i=1:ntrials
     dataA.time{i} =  dataA.time{i} - min(dataA.time{i})
     dataB.time{i} =  dataB.time{i} - min(dataB.time{i})
   end
or simply by copying the one time-axis into the other
   dataB.time = dataA.time
In the second case you should be carefull that you don't have a  
mismatch in the number of samples in the data and in the time axis. A  
single sample is sometimes easy to loose due to rounding off errors.

After that, you can do

cfg = []
cfg.keeptrials = 'yes'
avgA = timelockanalysis(cfg, dataA);
avgB = timelockanalysis(cfg, dataB);

and test the two conditions against each other.

I am not sure about the applicability of actvsblT as statistic here,  
but the trick above applies in general and hence should work with any  
statistic. Depending on the statistic that you use, you might have to  
be carefull about a difference in the baselining for the pre- and post- 
stimulus window. I.e. if you subtract the baseline estimated on the  
pre-stimulus window, then the pre-stimulus window will have less  
variance over trials regardless of the presence of an effect.

best regards,
Robert




On 20 Mar 2009, at 14:52, Christine Gruetzner wrote:

> Hi Eric,
>
> Sorry, this was just a little mistake in writing in my mail; I  
> actually use the same number of time samples for the task and the  
> baseline (cfg.latency = [0.05 0.4]) and the baseline (cfg.latency =  
> [-0.4 -0.05])!!
>
> Best
> Christine
>
>
>
> 2009/3/20 Eric Maris <e.maris at donders.ru.nl>
> Hi Christine,
>
>
>
>
> I have some trouble using 'timelockstatistics' for task vs baseline  
> comparisons (the code I'm using is pasted below).
>
> In the output of timelockstatistics, I get only one (!) time sample  
> (prob, stat, mask: 266 (channels) x 1 (time)), even if I specify the  
> parameter cfg.latency (e.g. [0 0.2]). However, when I plot the  
> statistics afterwards, it is possible to plot the whole time window  
> I specified in cfg.latency - even though the topography seems to be  
> the same for each time bin...
>
> The steps I do before computing timelockstatistics are the following:
> 1) Compute timelockanalyis separately for the task (cfg.latency =  
> [0.05 0.4]) and the baseline (cfg.latency = [-0.4 -0.5]) separately
> 2) Compute timelockgrandaverage for task and baseline
> 3) Use the code below to compute timelockstatistics
>
> Can anybody help me with this issue?
> I would be very glad about any suggestions on what is going wrong  
> here!!
>
>
> For permutation statistics with actvsblT to make sense, the number  
> of time samples in the activation and the baseline data must be  
> equal. This does not appear to be the case in your configuration for  
> timelockanalysis.
>
>
> Good luck,
>
>
> Eric Maris
>
>
>
>
>
>
>
> Best
> Christine
>
>
> cfg = [];
> cfg.grad = timelockUprightTask{1}.grad;
> cfg.channel = {'MEG', '-MLP12', '-MRC14', '-MLT41', '-MRC25', '- 
> MRP56', '-MRT21', '-ML021', '-MRO44', '-MRT47'};
> cfg.statistic = 'actvsblT';
> cfg.clusterthreshold = 'parametric';
> cfg.clusteralpha = 0.05;
> cfg.alpha = 0.05;
> cfg.makeclusters = 'yes';
> cfg.minnbchan = 3;
> cfg.parameter = 'individual';
> cfg.clusterstatistic = 'maxsum';
> cfg.onetwo = 'twosided';
> cfg.method = 'montecarlo';
> cfg.correctm = 'cluster';
> cfg.numrandomization = 1000;
> cfg.latency = [0 0.2];
> nSubjects = length(filesUprightTask);
> a = [1:nSubjects];
> b = ones(1,nSubjects);
> cfg.design = [a a; b (2*b)];
> cfg.uvar = 1;
> cfg.ivar = 2;
> timelockstat =  
> timelockstatistics(cfg,timelockUprightTaskGA,timelockUprightBaseGA);
>
>
>
>
> -- 
> Christine Gruetzner, geb.Tillmann
> Max-Planck-Institut für Hirnforschung
> Abt. Neurophysiologie
> Deutschordenstr. 46
> 60528 Frankfurt am Main
> Germany
>
> Phone: +49 (0)69/6301-83225
> E-Mail: tillmann at mpih-frankfurt.mpg.de
> http://www.mpih-frankfurt.mpg.de/global/Np/Staff/tillmann.htm
>
> ----------------------------------
>
> The aim of this list is to facilitate the discussion between users  
> of the FieldTrip toolbox, to share experiences and to discuss new  
> ideas for MEG and EEG analysis.
>
> http://listserv.surfnet.nl/archives/fieldtrip.html
>
> http://www.ru.nl/fcdonders/fieldtrip/
>
> ----------------------------------
>
> The aim of this list is to facilitate the discussion between users  
> of the FieldTrip toolbox, to share experiences and to discuss new  
> ideas for MEG and EEG analysis.
>
> http://listserv.surfnet.nl/archives/fieldtrip.html
>
> http://www.ru.nl/fcdonders/fieldtrip/
>
>
>
>
> -- 
> Christine Gruetzner, geb.Tillmann
> Max-Planck-Institut für Hirnforschung
> Abt. Neurophysiologie
> Deutschordenstr. 46
> 60528 Frankfurt am Main
> Germany
>
> Phone: +49 (0)69/6301-83225
> E-Mail: tillmann at mpih-frankfurt.mpg.de
> http://www.mpih-frankfurt.mpg.de/global/Np/Staff/tillmann.htm
>
>
> ----------------------------------
>
> The aim of this list is to facilitate the discussion between users  
> of the FieldTrip toolbox, to share experiences and to discuss new  
> ideas for MEG and EEG analysis.
>
> http://listserv.surfnet.nl/archives/fieldtrip.html
>
> http://www.ru.nl/fcdonders/fieldtrip/
>

----------------------------------
The aim of this list is to facilitate the discussion between users of the FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip.



More information about the fieldtrip mailing list