[Eeglablist] averaging time-frequency maps in eeglab
Arnaud Delorme
arno at salk.edu
Thu Mar 18 12:44:08 PST 2004
Dear Scott and Wang,
for averaging time-frequency analysis accross subjects, use the function
tftopo.m. I attached a script for computing time-frequency decomposition
for all electrodes of a dataset, then call tftopo to plot the topography
of the ERSP at specific time-frequency points (there is no menu
equivalent for tftopo in eeglab yet).
You may modify the script to scan several subjects.
Using tftopo() you may set a threshold in terms of the number of subject
showing a significant effect (this binomial approach is usefull to
correct for multiple comparisons since, by chance, there is a very low
probability that a large number of subjects will show a significant
effect at the same time-frequency point).
About plotting: the function timef() actually allow to specify no
graphical output (" 'plotersp','off', 'plotitc','off' " as in the
exemple below).
Hope this help.
Best
Arno
% compute tftopo for all channels in one EEGLAB dataset
% Arnaud Delorme, Nov 19, 2003
% ----------------------------
rmbaseline = 0;
% computing time-frequency decomposition for all electrodes
% ---------------------------------------------------------
for elec = 1:EEG.nbchan
[ersp,itc,powbase,times,freqs,erspboot,itcboot] = pop_timef(EEG, ...
1, elec, [EEG.xmin EEG.xmax]*1000, [3 0.5], 'maxfreq', 50, 'padratio', 4, ...
'plotphase', 'off', 'timesout', 60, ...
'alpha', .05, 'plotersp','off', 'plotitc','off');
if elec == 1
allersp = zeros([ size(ersp) EEG.nbchan]);
allitc = zeros([ size(itc) EEG.nbchan]);
allpowbase = zeros([ size(powbase) EEG.nbchan]);
alltimes = zeros([ size(times) EEG.nbchan]);
allfreqs = zeros([ size(freqs) EEG.nbchan]);
allerspboot = zeros([ size(erspboot) EEG.nbchan]);
allitcboot = zeros([ size(itcboot) EEG.nbchan]);
end;
allersp (:,:,elec) = ersp;
allitc (:,:,elec) = itc;
allpowbase (:,:,elec) = powbase;
alltimes (:,:,elec) = times;
allfreqs (:,:,elec) = freqs;
allerspboot (:,:,elec) = erspboot;
allitcboot (:,:,elec) = itcboot;
end;
% removing the common power baseline
% ----------------------------------
if rmbaseline == 1
meanpowbase = mean(allpowbase,3);
for elec = 1:EEG.nbchan
% adding back old baseline
% ------------------------
allersp (:,:,elec) = allersp (:,:,elec) + repmat( 10*log10(allpowbase(:,:,elec))', [1 size(allersp,2)]);
allerspboot(:,:,elec) = allerspboot(:,:,elec) + repmat( 10*log10(allpowbase(:,:,elec)) , [size(allerspboot,1) 1]);
% subtracting new baseline
% ------------------------
allersp (:,:,elec) = allersp (:,:,elec) - repmat( 10*log10(meanpowbase)', [1 size(allersp,2)]);
allerspboot(:,:,elec) = allerspboot(:,:,elec) - repmat( 10*log10(meanpowbase) , [size(allerspboot,1) 1]);
end;
end;
% plotting time/frequency transform
% ---------------------------------
figure;tftopo(allersp,alltimes(:,:,1),allfreqs(:,:,1),'mode','ave','limits',[nan nan nan 35 -1.5 1.5], ...
'signifs', allerspboot, 'sigthresh', [6], 'timefreqs', [100 10; 300 10; 400 10; 500 10], 'chanlocs', EEG.chanlocs);
More information about the Eeglablist
mailing list