[FieldTrip] Help with Cluster-Based Permutation Tests

Stephen Politzer-Ahles politzerahless at gmail.com
Sat Mar 14 14:12:28 CET 2020


I would recommend using the tutorials on the FieldTrip wiki instead (
http://www.fieldtriptoolbox.org/tutorial/); while I'm sure the tutorial you
linked is great, it's 8 years old so some things may have changed, and the
code there is for Neuroscan data. If you work through the tutorials on the
wiki you will find a lot of reference information about what the various
fields in each function mean, and within the tutorial there's not just
sample code but also explanations of what everything in the code is for.
For instance, in your case, I'm not sure you need to use the fields
headerformat/dataformat/eventformat at all (I haven't worked with EGI data,
but at least in my own data processing I've never had to use any of these
fields when running ft_definetrial).

>From the table of contents linked above, I think the bare minimum tutorials
you'll need to go through to get from raw data to cluster-based tests is
"Introduction to the FieldTrip toolbox", "Preprocessing - Trigger based
trial selection", "Preprocessing of EEG data and computing ERPs", and
"Cluster-based permutation tests on event related fields". My
recommendation would be to go through this entire sequence (and possibly
others if needed, such as artifact rejection) using the sample data
provided with the tutorial, since it's guaranteed to work, and then once
you've done that and have better sense of how things work it should be
easier to figure out how to adapt this for your own dataset. That will also
make it easier to figure out where the problems are coming up (for example,
based on your description so far, it sounds like your problem now isn't
actually with cluster-based permutation tests but with importing data).

Best,
Steve






> Good afternoon,
>
> According to the tutorial I was using (link provided in original message)
> this was at the very beginning of processing. So, in this case, we were
> using a raw .mff file that had no previous processing done. This tutorial
> ran in tandem with a video (link also provided prior) and so I attempted to
> follow the steps that way. Therefore - yes, the error we ran into was
> simply importing the data! This is our first issue in our overall goal of
> attempting to run a CBPT, so you are correct there. So our issue here is
> not fully understanding the information related to importing the data (as
> the example uses Neuroscan headers, etc. which are different from ours, of
> course).
>
> I appreciate the paper you shared. I will look into it and keep working on
> this. With our little knowledge of Matlab code, trying to figure out errors
> in the code provides its own challenges, so this is all new to us.
>
> Many thanks!
>
> On Thu, Mar 12, 2020 at 7:34 PM Stephen Politzer-Ahles <
> politzerahless at gmail.com> wrote:
>
> > Could you clarify what step of the processing this cfg code is for?
> > Processing data and eventually running a cluster-based permutation test
> > requires many steps, most of which have their own function, and each
> > function has its own cfg structure to go along with it (the cfg structure
> > is just a way of passing arguments to the function). The cfg you've put
> > here looks like it's related to importing the data, rather than part of
> > actually running the permutation test.
> >
> > To get started, I would recommend reading the paper by Maris & Oostenveld
> > (2007), which explains the logic and procedures for the test, and going
> > through the tutorial at
> > http://www.fieldtriptoolbox.org/tutorial/cluster_permutation_timelock/;
> > that has the code you're going to need, and it comes with a dataset
> already
> > prepared, so you'll be able to go through the whole thing with the sample
> > data to see how it works before you try it on yours. Unfortunately, I
> don't
> > think there's any way around learning MATLAB code; to be able to run
> these
> > tests and know what you're doing (enough to avoid making mistakes, or to
> > notice if you do make a mistake) you will need at least basic familiarity
> > with MATLAB.
> >
> > As for your other questions:
> > --I don't think the results will differ as a function of whether you
> > import a raw file and process within fieldtrip, or whether you process
> > elsewhere and then import averages. Most of the processing is going to
> come
> > out the same wherever you do it (there are some minor differences in the
> > default settings of the filters used by Fieldtrip vs. those used by,
> e.g.,
> > EEGLAB). The bigger issue is what's easier. For me, I sometimes find it a
> > little difficult to import already-averaged data into fieldtrip (there
> > surely is a way to do it, but in my own pipeline I just hack it -- which
> > also requires a decent familiarity with MATLAB code and with the
> structure
> > of Fieldtrip objects). Personally I find it easier to just do the
> > preprocessing within Fieldtrip (YMMV, though, depending on how familiar
> you
> > are with Fieldtrip).
> > --As for the best data type for importing, I haven't worked with EGI so
> > I'm not familiar with any of these or how they work with Fieldtrip, but
> > there definitely are other people on the mailing list who will be; I'd
> > recommend sending this as a separate question on its own.
> >
> > ---
> > Stephen Politzer-Ahles
> > The Hong Kong Polytechnic University
> > Department of Chinese and Bilingual Studies
> > http://www.polyu.edu.hk/cbs/sjpolit/
> >
> >
> >
> >
> >> ----------------------------------------------------------------------
> >>
> >> Message: 1
> >> Date: Wed, 11 Mar 2020 09:50:52 -0400
> >> From: Ryan Priefer <rpriefer at adelphi.edu>
> >> To: fieldtrip at science.ru.nl
> >> Subject: [FieldTrip] Help with Cluster-Based Permutation Tests
> >> Message-ID:
> >>         <CAHto=
> >> cjaw+-_NKHNMy4Rkp1YeeFu7dd6xjAq-iysH-yj2nB2cA at mail.gmail.com>
> >> Content-Type: text/plain; charset="utf-8"
> >>
> >> Hello,
> >>
> >> I work as a Lab Coordinator for the Neurocognition of Communication
> >> Disorders Lab at Adelphi University, New York. We are looking to
> perform a
> >> cluster-based permutation test on our EEG data but have some questions
> as
> >> we are quite unfamiliar with how to apply it to this data in particular,
> >> and neither of us are too familiar with Matlab code.
> >>
> >> We collect our EEG data using a 128-HydroCel Geodesic Sensor Net from
> >> EGI/Philips, and therefore we have used NetStation to do most of our
> >> processing in the past.
> >>
> >> We have attempted to utilize the bountiful tutorials FieldTrip provides
> on
> >> their website and YouTube channel but to no avail. Specifically, we were
> >> using this <https://pastebin.com/yskmVKAh> code alongside this
> >> <https://vimeo.com/45658196> workshop video. We are simply not savvy
> >> enough
> >> with Matlab code, despite these resources, and would really appreciate
> if
> >> someone could provide some clarity on the process. Even the tutorials
> seem
> >> to assume the user is knowledgeable about Matlab code/certain, intricate
> >> things about the data itself that we just are not.
> >>
> >> We get stuck quite early on, particularly because we don't know what
> >> cfg.headerformat, cfg.dataformat, and cfg.eventformat would be for our
> >> system, as this seems to specify for the neuroscan system :
> >>
> >>    1. cfg=[]; % empties the universally used cfg-structure
> >>    2. cfg.dataset=data{1}; % which dataset? Useful if a for-loop is used
> >>    3. cfg.trialdef.eventtype= '?'; % We don't know what events have
> >> happened
> >>    4. cfg.headerformat='ns_cnt32'; % Watch Out! With the neuroscan
> system,
> >>    you have to set the bit-rate
> >>    5. cfg.dataformat='ns_cnt32'; % Otherwise you'll have corrupt data
> >>    6. cfg.eventformat='ns_cnt32';
> >>
> >>
> >> Some additional questions:
> >>
> >> Do you suggest beginning with a raw file and doing all processing in
> >> fieldtrip for the best results? As of now we have been using a
> combination
> >> of EEGLAB and NetStation 5 to process the data. We are assuming and
> hoping
> >> that all of this fieldtrip analysis could be one on a completely
> >> processed,
> >> averaged EEG file - but what file type works best? The default for EGI
> is
> >> .mff, but we could use .raw, .mat, .txt, and so on as exports from the
> NS5
> >> program..
> >>
> >> Please advise as to what to do, or what further information you'd like
> >> from
> >> us. I apologize for potentially a loaded, vague question. We are very
> new
> >> to this type of analyzing (we usually use R/RStudio).
> >>
> >> Thank you,
> >>
> >> --
> >> Ryan Priefer
> >> Lab Technical Coordinator
> >> Communication Sciences and Disorders
> >> t: 516.877.6787
> >> -------------- next part --------------
> >> An HTML attachment was scrubbed...
> >> URL: <
> >>
> http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20200311/5224717e/attachment-0001.htm
> >> >
> >>
> >>
> > _______________________________________________
> > fieldtrip mailing list
> > https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> > https://doi.org/10.1371/journal.pcbi.1002202
> >
>
>
> --
> Ryan Priefer
> Lab Technical Coordinator
> Communication Sciences and Disorders
> t: 516.877.6787
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20200313/4711f60a/attachment-0001.htm
> >
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> fieldtrip mailing list
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> _______________________________________________
> fieldtrip mailing list
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> https://doi.org/10.1371/journal.pcbi.1002202
>
>
> ------------------------------
>
> End of fieldtrip Digest, Vol 112, Issue 12
> ******************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20200314/6cc872a1/attachment.htm>


More information about the fieldtrip mailing list