[FieldTrip] Cluster statistics

Lustenberger Caroline Caroline.Lustenberger at kispi.uzh.ch
Mon Nov 12 16:55:35 CET 2012

Dear Steve

It seems to work now. However, when I have NaN values in my powerspectrum array, I recieve the following error:

??? Invalid MEX-file
The specified module could not be found.

Error in ==> statfun_depsamplesT at 98
    avgdiff = nanmean(diffmat,2);

Error in ==> statistics_montecarlo at 240
  [statobs, cfg] = statfun(cfg, dat, design);

Error in ==> ft_freqstatistics at 279
  [stat, cfg] = statmethod(cfg, dat, cfg.design);

What might be the problem?

Is there a detailed documentation about the command ft_freqstatistics, especially about the meanings of the stats output and what kind of input is possible (e.g. t-test, ...)

Thanks again for all your help and best wishes

Von: fieldtrip-bounces at science.ru.nl [mailto:fieldtrip-bounces at science.ru.nl] Im Auftrag von Stephen Politzer-Ahles
Gesendet: Montag, 12. November 2012 14:30
An: fieldtrip at science.ru.nl
Betreff: Re: [FieldTrip] Cluster statistics

Hi Caroline,

It looks to me like your grand averages don't have any EEG data in them; here is what mine look like:

         label: {60x1 cell}
          time: [1x601 double]
    individual: [19x60x601 double]
        dimord: 'subj_chan_time'
           cfg: [1x1 struct]
          elec: [1x1 struct]

To run cluster statistics your structure has to have that "individual" field, which has the ERPs for each subject (for instance, from mine you can see I had 19 subjects with a 60-channel cap, and 601 samples in the epoch). I got mine by importing each subject's data into FieldTrip, and then using ft_timelockgrandaverage() with cfg.keepindividual='yes'.

That is my guess about what your problem is, but I could be wrong. After you ran it, did you check stat.posclusters and stat.negclusters? I think those are more important than stat.stat and stat.prob; they tell you which clusters are actually significant (and stat.posclusterslabelmat and stat.negclusterslabelmat tell you where/when the clusters are).


Message: 1
Date: Sun, 11 Nov 2012 13:25:31 +0000
From: Lustenberger Caroline <Caroline.Lustenberger at kispi.uzh.ch<mailto:Caroline.Lustenberger at kispi.uzh.ch>>
To: "fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>" <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>>
Subject: [FieldTrip] Cluster statistics
Message-ID: <2B94F80C-7331-45B9-86BF-2ED1123B680A at kispi.uzh.ch<mailto:2B94F80C-7331-45B9-86BF-2ED1123B680A at kispi.uzh.ch>>
Content-Type: text/plain; charset="utf-8"

Dear fieldtrip users

I tried to perform cluster analysis with fieldtrip. Since I've performed preprocessing/frequency analysis before using fieldtrip, I had to form the specific
data structure to use for ft_freqstatistics by myself.

I made a a structur as follows:
Condition 1 'EEGa':
--> 10 subjects:
        label: {128x1 cell} %128 egi elec.
        dimord: 'chan_freq'
         freq: 1
    powspctrm: [128x1 double]
    cumtapcnt: 1
          cfg: [1x1 struct]

Condition 2 'EEGm':
        label: {128x1 cell}
        dimord: 'chan_freq'
         freq: 1
    powspctrm: [128x1 double]
    cumtapcnt: 1
          cfg: [1x1 struct]

Then I performed the following steps:

cfg = [];

cfg.elec = elec; %was defined before EGI 128 electrodes

cfg.neighbours = neighbours; %also successfully defined before

cfg.latency = 'all';

%cfg.frequency = 'all';

cfg.channel = 'all';%eleselection % see CHANNELSELECTION

cfg.avgovertime = 'no';

%cfg.avgoverfreq = 'no';

cfg.avgoverchan = 'no';

cfg.statistic = 'depsamplesT';

cfg.numrandomization = 2^10;

cfg.correctm = 'cluster';

cfg.method = 'montecarlo';

cfg.clusteralpha = 0.05;

cfg.alpha = 0.05;

cfg.alpha = 0.05;

cfg.clustertail = 0;

cfg.feedback = 'gui';

cfg.parameter = 'powspctrm';

cfg.design = [

1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9<tel:9%2010%201%202%203%204%205%206%207%208%209> 10 % subject number

1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 ]; % condition number

cfg.uvar = 1; % "subject" is unit of observation

cfg.ivar = 2; % "condition" is the independent variable

stat = ft_freqstatistics(cfg, EEGa{:}, EEGm{:});

The function ft_freqstatistics runs but the stats results are strange.
My stats.stat is always -inf
and stats.prob always 0

What might be the problem?

Thanks and all the best
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20121112/46b2fb96/attachment-0002.html>

More information about the fieldtrip mailing list