freqstastics script

Eric Maris e.maris at DONDERS.RU.NL
Sat Sep 19 22:26:40 CEST 2009


Dear Claudia,


> I'm just surprised no one has written one before. MEG data generally
requires non-
> parametric statistics and the kruskalwallis test for freqstatistics was
the only option
> I found for this in fieldtrip. Am I right about this?


The story is a bit more complicated. One must make a distinction between a
test statistic and its reference distribution (the distribution under which
the p-value is calculated). Many users of Fieldtrip use it to do
cluster-based permutation tests. These are non-parametric tests because the
p-value is calculated under a non-parametric reference distribution.
However, the test statistic for which this p-value is calculated often
involves the classical test statistics like F and T, for which parametric
reference distributions exist. These parametric reference distributions do
not play role in the whether or not the cluster-based permutation tests
control the false alarm rate.
This argument allows one to do non-parametric testing with test statistics
that are inspired by classical parametric statistics. This is all much
better explained in Maris & Oostenveld (2007). Thus, the Kruskal-Wallis test
statistic is not required if you want to use the non-parametric
cluster-based permutation tests in Fieldtrip.

I'm sorry if this sounds complicated. One just needs to go a little bit in
the theory to get the ideas straight.


Best,

Eric Maris



> 
> -----Original Message-----
> From: Jan-Mathijs Schoffelen [mailto:j.schoffelen at PSY.GLA.AC.UK]
> Sent: Saturday, September 19, 2009 4:56 AM
> To: FIELDTRIP at NIC.SURFNET.NL
> Subject: Re: [FIELDTRIP] freqstastics script
> 
> You will have to write a statfun_kruskalwallis.
> 
> Best,
> 
> Jan-Mathijs
> 
> 
> 
> On 18 Sep 2009, at 19:15, Bonin, Claudia (NIH/NINDS) [F] wrote:
> 
> > DOES ANYONE KNOW HOW TO USE THE FIELDTRIP FUNCTION
> FREQSTATISTICS TO
> > RUN A KRUSKALWALLIS TEST?
> >
> > -----Original Message-----
> > From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On
> > Behalf Of Bonin, Claudia (NIH/NINDS) [F]
> > Sent: Wednesday, September 16, 2009 1:06 PM
> > To: FIELDTRIP at NIC.SURFNET.NL
> > Subject: Re: [FIELDTRIP] freqstastics script
> >
> > Hi. I am having trouble getting a freqstastics script to run to do a
> > Kruskalwallis test. Thre freqgrandaverage works but I am having
> > trouble with the arguments for the Kruskalwallis. I have pasted in
> > the script and the error message in this email.  Has anyone written
> > a script using freqsstatistics to do Kruskalwallis? I would love to
> > see it or get some direction on the arguments that need to be
> > assigned....Also I made up an argument for cfg.design but I don't
> > really understand what this assignment is. Could anyone elaborate?
> > Thank you!
> > claudia Bonin
> >
> >
> >
> >
> >
> > here's the error message
> >
> > isnan(data.time)
> > ??? Undefined function or method 'isnan' for input arguments of type
> > 'cell'.
> >
> > computing average power over 21 subjects
> > Warning: discarding gradiometer information
> >> In freqgrandaverage at 121
> >  In tf2_virt_all_plot at 11
> >
> > here's the script.....
> >
> >
> > Nsubj = 21;
> >
> > for subj = 1:Nsubj
> >    fname = ['/home/boninc/tfresults/subj' 64 + subj];
> >    clear fr
> >    load(fname);
> >    frs(subj) = fr;
> > end
> >
> > cfg = [];
> > [gr] = freqgrandaverage(cfg, frs(1), frs(2), frs(3), frs(4), frs(5),
> > frs(6), frs(7), frs(8), frs(9), frs(10), frs(11), frs(12), frs(13),
> > frs(14), frs(15), frs(16), frs(17), frs(18), frs(19), frs(20),
> > frs(21));
> >
> > %cfg = [];
> > %cfg.alpha = .05;
> > %cfg.method = 'stats';
> > %cfg.design = 1:21;
> > %cfg.statistic = 'kruskalwallis';
> > %[stat] = freqstatistics(cfg, frs(1), frs(2), frs(3), frs(4),
> > frs(5), frs(6), frs(7), frs(8), frs(9), frs(10), frs(11), frs(12),
> > frs(13), frs(14), frs(15), frs(16), frs(17), frs(18), frs(19),
> > frs(20), frs(21));
> >
> > clf
> > contourf(gr.time, gr.freq, squeeze(sum(gr.powspctrm))); colorbar
> > %contourf(gr.time, gr.freq, gr.powspctrm); colorbar
> >
> > title '21 Subjects, RandL, RIGHT Central Motor'
> > xlabel 'time, sec'
> > ylabel 'frequency, Hz'
> >
> >
> > ________________________________________
> > From: FieldTrip discussion list [FIELDTRIP at NIC.SURFNET.NL] On Behalf
> > Of Hanneke Van Dijk [Hanneke.vanDijk at MED.UNI-DUESSELDORF.DE]
> > Sent: Thursday, September 10, 2009 7:21 AM
> > To: FIELDTRIP at NIC.SURFNET.NL
> > Subject: [FIELDTRIP] AW: [FIELDTRIP] freqstastics script
> >
> > Dear Claudia,
> >
> > Normally when matlab says 'undefined function for input of
> > type ....' it means it cannot find the specific function in the
> > paths you have defined. You can check whether neighbourselection.m
> > is in your fieldtrip folder, if not I have attached it (version
> > 20090428) so you can put it there. If this doesn't fix it please let
> > me know!
> >
> > Groetjes Hanneke
> >
> >
> > -----Ursprüngliche Nachricht-----
> > Von: FieldTrip discussion list im Auftrag von Bonin, Claudia (NIH/
> > NINDS) [F]
> > Gesendet: Mi 09.09.2009 18:26
> > An: FIELDTRIP at NIC.SURFNET.NL
> > Betreff: [FIELDTRIP] freqstastics script
> >
> > I am trying to do statistics on time-frequency data across 16
> > subjects, averaging over channels. I received back the following
> > error about 'neighbourselection' which means nothing to me.....Does
> > anyone have any idea what might be wrong here? I have pasted in the
> > exact message below.
> > thanks!
> > claudia
> >
> >
> >>> cfg.statistic = 'kruskalwallis';
> >>> cfg.method = 'stats';
> >>> [s] = freqstatistics(cfg, fr, fr);
> > averaging over 3 channels
> > selected 50 time bins
> > selected 41 frequency bins
> > Warning: PACK can only be used from the MATLAB command line.
> >> In fieldtrip/private/prepare_timefreq_data at 305
> >  In fieldtrip/private/statistics_wrapper at 167
> >  In freqstatistics at 44
> > ??? Undefined function or method 'neighbourselection' for input
> > arguments of type
> > 'struct'.
> >
> > Error in ==> statistics_wrapper at 181
> >    cfg = neighbourselection(cfg,varargin{1});
> >
> > Error in ==> freqstatistics at 44
> > [stat] = statistics_wrapper(cfg, varargin{:});
> > ----------------------------------
> > 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/neuroimaging/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/neuroimaging/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/neuroimaging/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/neuroimaging/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/neuroimaging/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/neuroimaging/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/neuroimaging/fieldtrip.



More information about the fieldtrip mailing list