[Eeglablist] Random selection of trials

Arnaud Delorme arno at ucsd.edu
Thu Apr 1 12:49:34 PDT 2010

Dear Kris,

in EEGLAB try the statcond function. It will perform boostrap,  
permutation (bootstrap and permutation are two resampling techniques),  
or compute parametric statistics and return p-values. If you have 2  
EEGLAB datasets 1 and 2 (on which you have extracted data epochs of  
the same length), on the command line, try

[t df p] = statcond({ ALLEEG(1).data ALLEEG(2).data }, 'mode',  
'bootstrap', 'naccu', 1000);
% or [t df p] = statcond({ ALLEEG(1).data ALLEEG(2).data}, 'mode',  
% or [t df p] = statcond({ ALLEEG(1).data ALLEEG(2).data}, 'mode',  

then use FDR to correct for multiple comparisons

p = fdr(p);

then plot the result with a threshold at 0.05 for a given channel

chan = 10;
erp_1 = mean(ALLEEG(1).data(chan,:,:),3);
erp_2 = mean(ALLEEG(2).data(chan,:,:),3);
plotcurve(ALLEEG(1).times, [erp_1; erp_2], 'maskarray', p(chan,:) <  

Hope this helps,


ps: with many channels, time points, and trials, the bootstrap  
computation may take several minutes

On Apr 1, 2010, at 11:10 AM, Bradley Voytek wrote:

> Kris:
> One of the best ways of doing this--from a statistical
> standpoint--would be through resampling statistics. I've attached a
> quick example script that should be correct.
> Also, here's a quick description.
> http://en.wikipedia.org/wiki/Resampling_%28statistics%29
> First, calculate the real mean difference between your two datasets,
> and set this value aside.
> Next, put all your data into a big pile (for a total of, in your case,
> 1650 data points).
> Next, randomly grab 150 points and calculate that mean. Grab the
> remaining 1500 points and calculate that mean. Then calculate the
> difference of these two means.
> Repeat a lot (e.g., 10000 times) to get a distribution of possible
> mean differences.
> This gives you a distribution of possible difference values given the
> actual data. Because you're taking means of means, this distribution
> of surrogate values approaches normality (see the central limit
> theorem), and thus we can calculate a z-score and p-value.
> Conceptually what you're doing is asking whether the real difference
> you observe between conditions is due to your experimental
> manipulation or whether it's an artifact of the possible states your
> data can obtain.
> ::bradley voytek
> On Wed, Mar 31, 2010 at 08:04, Kris Baetens <Kris.Baetens at vub.ac.be>  
> wrote:
>> Dear colleagues,
>> We employ a paradigm which inherently leads to a different number  
>> of trials in both our conditions (oddball-like). We have two  
>> conditions, one with an average of about 150 trials, the other with  
>> about 1500 (artefact-free).
>> - Does anybody have research to support my concern that comparing  
>> both conditions with the total number of trials may lead to  
>> artificial effects due to the different number of trials (and  
>> associated variance and "cleanliness" of the gavg's)? (I have seen  
>> such things published before.)
>> - Does anybody know of an easy way to make a random selection of a  
>> predetermined number of trials out of the total number in EEGLAB or  
>> MATLAB? (Which would allow for selecting an equal number of trials  
>> in both conditions.) Obviously, we don't simply want to take the  
>> first or last 150 regular trials, since this would possibly lead to  
>> erronous conclusions.
>> Thank you very much in advance,
>> Kris Baetens
>> Ph.D. fellow of the Research Foundation - Flanders (FWO)
>> Dept. Experimental and Applied Psychology
>> Faculty of Psychology and Educational Sciences
>> Vrije Universiteit Brussel
>> _______________________________________________
>> Eeglablist page: http://sccn.ucsd.edu/eeglab/eeglabmail.html
>> To unsubscribe, send an empty email to eeglablist-unsubscribe at sccn.ucsd.edu
>> For digest mode, send an email with the subject "set digest mime"  
>> to eeglablist-request at sccn.ucsd.edu
> <example_surrogate_stats.m><ATT00001..txt>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20100401/a58ed0f6/attachment.html 

More information about the eeglablist mailing list