[Eeglablist] pop_reref to exclude some channels for average reference

Sue Peters sp at suepeters.com
Tue Oct 6 14:55:45 PDT 2015


Thanks Stephen.  Thanks for the testing code - it was very helpful. I had
to edit some of the code at the bottom, and tested both approaches that I
originally posted. The reref function,seems to remove all of the channels
that are included in the 'ref' array, then leaving only channels that were
not part of the average. Does anyone know why this is customary? Even if a
channel is not included in the average, why not keep it in the data
structure? I guess I will consider using your code to write a new function,
which keeps all channels in the structure, rather than removing them.

I tested the exclude function, and this does not give the same results.  It
seems the exclude value is for specification of which channels to
rereference, but not which channels to include in the new average reference.

I learned a lot from this. Thanks!



Sue Peters
PhD Candidate

Center for Molecular and Behavioral Neuroscience
Rutgers University - Newark
197 University Avenue, Room 209
Newark, New Jersey, 07102
USA

sp at suepeters.com
mobile: 646-337-7025
fax: 206-338-2972

www.linkedin.com/in/suepeters

On Wed, Sep 30, 2015 at 5:25 PM, Stephen Politzer-Ahles <
stephen.politzer-ahles at ling-phil.ox.ac.uk> wrote:

> Hi Sue,
>
> This should work fine. If you need to double-check, re-referencing is a
> simple mathematical operation so you can also do it on the data by hand and
> see if the output of pop_reref is the same as what you got by hand.
> Something like this should work:
>
>
> % channels to include in avg ref
> channels_to_include = [1:16 18:31 33:37 39:42 45:47 50:55 58:62 65:67
> 70:72 75:80 83:87 90:93 96:98 101:106 108:112 115:118 122:124];
>
> % store the raw data
> raw = EEG.data;
>
> % the avg to be subtracted from other channels
> average = mean( raw(channels_to_include,:), 1 );
>
> % average-referenced data
> my_reref = raw - repmat( average, [size(raw,1) 1] );
>
> % rereference using EEGLAB
> EEG = pop_reref(EEG, channels_to_include);
>
> % store the eeglab-referenced data
> eeglab_reref = EEG.data;
>
> % choose a channel to plot, doesn't really matter which
> channel = 5;
>
> % choose some time window to plot, doesn't really matter which
> samples = 1:500;
>
> % plot to see if the results are different (if they're the same, which is
> good, you'll see only one line )
> figure;
> hold on;
> plot( 1:500, [my_reref; eeglab_reref] );
> legend( {'re-referenced by hand' 're-referenced using EEGLAB'} );
>
>
>
>
>
> ---
> Stephen Politzer-Ahles
> University of Oxford
> Language and Brain Lab, Faculty of Linguistics, Phonetics & Philology
> http://users.ox.ac.uk/~cpgl0080/
>
> On Tue, Sep 29, 2015 at 11:39 PM, Sue Peters <sp at suepeters.com> wrote:
>
>> Dear EEGLab Users,
>>
>> I am using this function, pop-reref, for an average reference of 124
>> channels.  However, I would like to exclude 16 of these channels from the
>> average reference calculation. I have used the 'exclude' input to specify
>> the exclusion of these channels:
>>
>> EEG = pop_reref( EEG, [], 'exclude', [17 43 48 49 56 63 68 73 81 88 94 99
>> 107 113 119 120]);
>> %16 channels removed leaving 108 for av ref
>>
>> I've also tried just selecting specifying the 108 channels directly:
>>
>>  EEG = pop_reref(EEG, [1:16 18:31 33:37 39:42 45:47 50:55 58:62 65:67
>> 70:72 75:80 83:87 90:93 96:98 101:106 108:112 115:118 122:124]);
>>
>> But I'm not sure that either is working correctly, and am not sure how to
>> confirm that the function is actually averaging the 108 channels, and using
>> these as the reference.
>>
>> Any thoughts are welcome!
>>
>> Thanks,
>>
>>
>> Sue Peters
>> PhD Candidate
>>
>> Center for Molecular and Behavioral Neuroscience
>> Rutgers University - Newark
>> 197 University Avenue, Room 209
>> Newark, New Jersey, 07102
>> USA
>>
>> sp at suepeters.com
>> mobile: 646-337-7025
>> fax: 206-338-2972
>>
>> www.linkedin.com/in/suepeters
>>
>> _______________________________________________
>> 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/20151006/d630707c/attachment.html>


More information about the eeglablist mailing list