[Eeglablist] How to calculate average over specific time frame

Stephen Politzer-Ahles politzerahless at gmail.com
Mon Dec 2 13:03:31 PST 2013


Hi Nynke,

I don't know if there is a GUI function or not, but I always do this at the
command line. Your .set file for each subject for each condition should
have EEG.data, which is a 3-dimensional matrix (channels x samples x
epochs).  Therefore,

erp = mean( EEG.data, 3 );

gives you the averaged ERP for that condition. And then you can use the
same function to get the mean of a slice of that matrix. For example,
something like this (I am assuming a certain pre-stimulus baseline, and
assuming you sampled at 1000 Hz; if your sampling rate is different than
1000 Hz you may need to adjust a bit):

baseline = -200;
window = [300 500];
mean_amplitude = mean(  erp( :, (window(1)-baseline):(window(2)-baseline)
), 2 );

I think that should do it; you'll want to check to make sure it makes sense
(e.g., mean amplitude should have as many rows as channels in your data,
and only one column). Then you can use a simple loop to iterate through
each subject and each condition, put all these means together into a
matrix, and print them out into Excel or whatever other format you want to
have them in for organizing them for SPSS. (If you are a hardcore
programmer there is probably a faster and better way to get the means for
every participant and every condition, but for the typical size of EEG
datasets I find a series of simple For loops to work fine as well.)

Best,
Steve



Stephen Politzer-Ahles
New York University, Abu Dhabi
Neuroscience of Language Lab
http://www.nyu.edu/projects/politzer-ahles/


On Sat, Nov 30, 2013 at 11:18 PM, Laan, L.N. van der (Nynke) <
L.N.vanderLaan at uu.nl> wrote:

>   Hello all,
>
>
>
> I am trying to calculate the mean value of an ERP over a specific
> timeframe (300-500 ms post stimulus (N400)), separately for each channel.
> But I can’t seem to find how to do that with EEGLab. I already used the
> averaging functions (e.g.,
> http://cognitrn.psych.indiana.edu/busey/temp/eeglabtutorial4.301/maintut/data_averaging.html)
> for other purposes, but what I would like to have now is one mean value
> (potential) per subject per condition. I need to prepare the data for a
> colleague who is going to process the data further in SPSS.
>
>
>
> I have epoched the datasets for all of my subjects and conditions
> (Subject1condA, subject2condB, etc.). What to do next?
>
>
>
> Thanks in advance!
>
>
>
> Best regards,
>
> Nynke
>
>
>
>
>
> _______________________________________________
> 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 --------------
An HTML attachment was scrubbed...
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20131203/c71c1408/attachment.html>


More information about the eeglablist mailing list