RAM use of freqstatistics

Ingrid Nieuwenhuis ingrid.nieuwenhuis at FCDONDERS.RU.NL
Tue Feb 17 20:40:11 CET 2009


Dear Michael,

As far as I can see you did not make any stupid mistakes. I think the reason
that freqstatistics uses so much RAM is because you are looking for clusters
over time, frequency and channels. Therefore you get a matrix with size
Nchan*Nfreq*Ntime for each randomization. With a fine time and frequency
resolution, this can become a lot of bites! If you already have a priory
hypothesis on the frequency band of interest, or the time of interest, you
could consider averaging over freq or time. If you don't want to do this,
you could maybe choose a coarser time and/or frequency resolution.

I hope this helps,
Ingrid

-----Original Message-----
From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf
Of Michael Wibral
Sent: Tuesday, February 17, 2009 11:16 AM
To: FIELDTRIP at NIC.SURFNET.NL
Subject: [FIELDTRIP] RAM use of freqstatistics

Dear Listusers,

I have recently started to use freqstatistics with the cfg.correctm =
'cluster' option again and I am a bit puzzled by the amount of RAM it uses -
but maybe that's normal. I just want to make sure I am not overlooking some
stupid mistake.

Here is the code (it uses ~20GB per 1000 randomization draws, never got it
to run through 5000+ iterations):

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PathName='/data/home1/wibral/Projects/HysteresisMEG/';
FileType='.mat';
AnalysisStr='TF_MTM_win125ms_fsm16p0Hz_Rel_';
PreprocStr='_0_cond_Preproc4LCMV_denoised_fmin0.5Hz_fmax200Hz_';

% contains the subject and date part of filename
Design={
'AEF29_HysteresisMEG_20080428';
'AKN13_HysteresisMEG_20080901';
'AZN28_HysteresisMEG_20080811';
'BAP07_HysteresisMEG_20090204';
'BRA29_HysteresisMEG_20080829';
'CHN03_HysteresisMEG_20080818';
'EKD25_HysteresisMEG_20080815';
'HZA25_HysteresisMEG_20080725';
'IWA05_HysteresisMEG_20080606';
'MBA11_HysteresisMEG_20080728';
'MTA07_HysteresisMEG_20090128';
'RRA18_HysteresisMEG_20080825';
'SKA29_HysteresisMEG_20090211';
'TSS07_HysteresisMEG_20080822';
};

for i=1:length(Design)
    fullname1=strcat(PathName,AnalysisStr,Design{i},PreprocStr,
condNr1,FileType);
    load(fullname1); % a variable named TFdata or TFdataRel exists after
this step
    data1{i}=TFdataRel; %
    clear TFdata; clear TFdataRel;

    fullname2=strcat(PathName,AnalysisStr,Design{i},PreprocStr,
condNr2,FileType);
    load(fullname2); %a variable named TFdata or TFdataRel exists after this
step
    data2{i}=TFdataRel; %
    clear TFdata; clear TFdataRel;
end;

cfg=[];
cfg.keepindividual='yes';
TFGA1 = freqgrandaverage(cfg,data1{:});
TFGA1.grad=data1{1}.grad; %get some gradiometer information for plotting
TFGA2 = freqgrandaverage(cfg,data2{:});
TFGA2.grad=data2{1}.grad; %get some gradiometer information for plotting

% do freqstatistics
cfg4stat=[];
cfg4stat.clusteralpha     = 0.05; % control admission to a cluster
cfg4stat.alpha            = 0.05; % control the false alarm rate of the
permutation test
cfg4stat.avgovertime      = 'no';
cfg4stat.avgoverfreq      = 'no';
cfg4stat.avgoverchan      = 'no';
cfg4stat.statistic = 'depsamplesT'; % test statistic to evaluate the effect
at the sample level
cfg4stat.numrandomization = (2^12); %
cfg4stat.correctm = 'cluster';
cfg4stat.method  = 'montecarlo';
cfg4stat.dimord = 'chan_freq_time';
cfg4stat.dim = 'chan_freq_time';
nSubjects = length(Design);
a = [1:nSubjects];
b = ones(1,nSubjects);
cfg4stat.design = [a a; b (2*b)];
cfg4stat.uvar = 1; % "subject" is unit of observation
cfg4stat.ivar = 2; % row of the design matrix that contains the independent
variable

FreqStatResult = freqstatistics(cfg4stat,TFGA1,TFGA2)


----------------------------------
The aim of this list is to facilitate the discussion between users of the
FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG
and EEG analysis. See also
http://listserv.surfnet.nl/archives/fieldtrip.html and
http://www.ru.nl/fcdonders/fieldtrip.

----------------------------------
The aim of this list is to facilitate the discussion between users of the FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/fcdonders/fieldtrip.



More information about the fieldtrip mailing list