# [Eeglablist] Random selection of trials

Thu Apr 1 11:10:36 PDT 2010

```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.

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
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: example_surrogate_stats.m
Type: application/octet-stream
Size: 641 bytes
Desc: not available
Url : http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20100401/1ecd5203/attachment.obj
```