# [Eeglablist] Different baseline correction for different types of event?

James Desjardins jdesjardins at brocku.ca
Sat Jul 3 10:24:40 PDT 2010

Hi Chris,

I do not know of a way to apply a condition specific baseline
correction in a single command. I have performed a similar
manipulation by segmenting the data into to two files and then
appending them together into a single file using "pop_mergeset". Then
continue further processing on the single appended dataset.

corrected to -200ms to 0ms) and you would like to change the baseline
period of your "chx","cix" condition type epochs to -1600ms to
-1400ms, a script like the following should work:

% Create a vector of baseline times plus zero point (ms) and convert
it to data point indices...
ms_vals=[-1800,-1600,0];
pnt_vals=round(ms_vals/(1000/EEG.srate)-((EEG.xmin*1000)/(1000/EEG.srate)-1));

% Obtain indices for epochs of the condition type to be changed...
j=0;
for i=1:length(EEG.event);
trial=EEG.event(i).epoch;
if
(strcmp(EEG.event(i).type,'chx')||strcmp(EEG.event(i).type,'cix'))&& ...
EEG.event(i).latency==pnt_vals(3)+EEG.pnts*(trial-1);
j=j+1;ind(j)=trial;
end
end

% Calculate baseline values for the epochs of the condition type to be
changed...
bl=mean(EEG.data(:,pnt_vals(1):pnt_vals(2),ind),2);

% Subtract baseline values from the epochs of the condition type to be
changed...
for i=1:EEG.nbchan;
for j=1:EEG.pnts;
EEG.data(i,j,ind)=EEG.data(i,j,ind)-bl(i,1,:);
end
end

James Desjardins
Technician, MA Student
Department of Psychology, Behavioural Neuroscience
Cognitive and Affective Neuroscience Lab
Brock University

Quoting Retzler Christopher <lpxcr at nottingham.ac.uk>:

> Hi
>
> I'm currently re-anlayzing some data, I have been epoching using the
>  following
>
>
>
> EEG = pop_epoch( EEG, {  'cho+'  'cho-'  'chx '  'cig+'  'cig-'
> 'cix '  }, [-2  2], 'newname', 'epochs', 'epochinfo', 'yes');
>
>
>
> [ALLEEG EEG CURRENTSET] = pop_newset(ALLEEG, EEG, 1, 'overwrite',
> 'on', 'gui', 'off');
>
>
>
> % baseline correct using -200 to 0 as baseline
>
> EEG = pop_rmbase(EEG,[-200 0]);
>
>
>
>
>
> Is it possible to apply seperate baseline corrections to two types
> of events? So for 'chx' and 'cix' events I would like to baseline
> correct at -1800 - -1600 as these are pre-response epochs. For the
> other events I would like to use  -200 - 0ms as the baseline (these
> are post-reponse). Ideally I would like to process these events
> together so that I can run the rest of pre-processing on the entire
> data set (i.e. ICA artifact rejection etc) and not have to do it
> twice.
>
>
>
>
>
> Chris Retzler
>
> PhD student
> School of Psychology
> University of Nottingham
> University Park
> Nottingham
> NG7 2RD.
> This message has been checked for viruses but the contents of an attachment
> may still contain software viruses which could damage your computer system:
> you are advised to perform your own checks. Email communications with the
> University of Nottingham may be monitored as permitted by UK legislation.