[FieldTrip] Reshape Error Using ft_freqstatistics

Schoffelen, J.M. (Jan Mathijs) jan.schoffelen at donders.ru.nl
Thu Sep 7 07:19:09 CEST 2017


In that case I recommend that you try and interpret the error message in a bit more detail. From the information you provide nobody can tell what’s going on, apart from the fact that it is a low-level matlab error. I suggest to use the matlab debugger to investigate the size of ‘meanreshapeddat', and the value of ‘nchan’ ‘nfreq’ ‘nrepl’ ‘ntime’ in this specific case.

And also think about your specification of cfg.latency. Note that you only include positive latencies to be tested, but you ask for actvsblT as a test statistic, which name suggests to use a baseline (i.e. require latencies of < 0 in the data).

JM


On 6 Sep 2017, at 18:43, David <preted at mcmaster.ca<mailto:preted at mcmaster.ca>> wrote:

Hi Jan-Mathijs,

I’ve double checked and the label is written as ‘CZ’. So, it seems to be more than a typo, unfortunately.

David

From: fieldtrip-request at science.ru.nl<mailto:fieldtrip-request at science.ru.nl>
Sent: September 6, 2017 12:26 PM
To: fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>
Subject: fieldtrip Digest, Vol 82, Issue 8

Send fieldtrip mailing list submissions to
                fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>

To subscribe or unsubscribe via the World Wide Web, visit
                https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
or, via email, send a message with subject or body 'help' to
                fieldtrip-request at science.ru.nl<mailto:fieldtrip-request at science.ru.nl>

You can reach the person managing the list at
                fieldtrip-owner at science.ru.nl<mailto:fieldtrip-owner at science.ru.nl>

When replying, please edit your Subject line so it is more specific
than "Re: Contents of fieldtrip digest..."


Today's Topics:

   1. Re: Reshape Error Using ft_freqstatistics
      (Schoffelen, J.M. (Jan Mathijs))
   2. Cluster-based permutation tests for 3 conditions (????)
   3. Re: Learning agreementbuybr 8 (STEPHAN MORATTI)


----------------------------------------------------------------------

Message: 1
Date: Wed, 6 Sep 2017 15:18:53 +0000
From: "Schoffelen, J.M. (Jan Mathijs)" <jan.schoffelen at donders.ru.nl<mailto:jan.schoffelen at donders.ru.nl>>
To: FieldTrip discussion list <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>>
Subject: Re: [FieldTrip] Reshape Error Using ft_freqstatistics
Message-ID: <0DE2CF55-749C-4F63-9DFA-FE226A971570 at donders.ru.nl<mailto:0DE2CF55-749C-4F63-9DFA-FE226A971570 at donders.ru.nl>>
Content-Type: text/plain; charset="utf-8"

Hi David,

Have you checked whether this could be due to a potential typo in the specification of your cfg.channel (e.g.: CZ versus Cz)?
Best,
Jan-Mathijs



On 6 Sep 2017, at 16:48, David <preted at mcmaster.ca<mailto:preted at mcmaster.ca><mailto:preted at mcmaster.ca>> wrote:

Hello everyone,

I am running into an error when I try to compute the cluster based permutation test in the frequency-time domain comparing baseline to when the stimulus is present. I?ve calculated the power for 300 milliseconds (1 millisecond is equal to one time point) before the onset of the stimulus and 300ms during the stimulus for a range of 10 frequencies. The error I?m running into is stated below as well as my code and I?ve attached an image of what the data looks like. I?ve tried following the tutorials and searching through the mailing list and can?t seem to find a solution.  Has anyone else run into this problem and found a solution or am I making an error somewhere in my analysis?


MY CODE:
    cfg = [];
    cfg.channel          = 'CZ';
    cfg.latency          = [0.1 0.4];
    cfg.method           = 'montecarlo';
    cfg.frequency        = 'all';
    cfg.statistic        = 'ft_statfun_actvsblT';
    cfg.correctm         = 'cluster';
    cfg.clusteralpha     = 0.05;
    cfg.clusterstatistic = 'maxsum';
    cfg.tail             = 0;
    cfg.clustertail      = 0;
    cfg.alpha            = 0.025;
    cfg.numrandomization = 500;

    ntrials = size(TFR_FFR.powspctrm,1);
    design  = zeros(2,2*ntrials);
    design(1,1:ntrials) = 1;
    design(1,ntrials+1:2*ntrials) = 2;
    design(2,1:ntrials) = [1:ntrials];
    design(2,ntrials+1:2*ntrials) = [1:ntrials];

    cfg.design   = design;
    cfg.ivar     = 1;
    cfg.uvar     = 2;

   TFR_FFR_stat =  ft_freqstatistics(cfg, TFR_FFR, TFR_FFRbaseline);


THE ERROR MESSAGE:
?Error using reshape
To RESHAPE the number of elements must not change.

Error in ft_statfun_actvsblT (line 115)
  timeavgdat=repmat(reshape(meanreshapeddat,(nchan*nfreq),nrepl),ntime,1);

Error in ft_statistics_montecarlo (line 267)
  [statobs, cfg] = statfun(cfg, dat, design);

Error in ft_freqstatistics (line 194)
    [stat, cfg] = statmethod(cfg, dat, design);

Error in TFRClusterBasedStats (line 54)
    TFR_FFR_stat =  ft_freqstatistics(cfg, TFR_FFR,
    TFR_FFRbaseline);?



Thank you,
David Prete
Ph.D. Candidate
McMaster Institute for Music and the Mind
Department Psychology, Neuroscience and Behaviour
McMaster University

<Screenshot (16).png>_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl><mailto:fieldtrip at donders.ru.nl>
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170906/ba4a2aa4/attachment-0001.html>

------------------------------

Message: 2
Date: Thu, 7 Sep 2017 00:57:17 +0900
From: ???? <tokimoto at mejiro.ac.jp<mailto:tokimoto at mejiro.ac.jp>>
To: FieldTrip discussion list <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>>
Subject: [FieldTrip] Cluster-based permutation tests for 3 conditions
Message-ID: <EF1907A8-7606-4B65-B3BB-CCEC15C62DA8 at mejiro.ac.jp<mailto:EF1907A8-7606-4B65-B3BB-CCEC15C62DA8 at mejiro.ac.jp>>
Content-Type: text/plain; charset="us-ascii"

Dear FieldTrip users,

I usually perform cluster-based permutation tests for my EEG analyses. The test is exact and useful, and I am deeply grateful for the developers. I understand permutation tests are a test between two conditions. However, I have realized that the test results can be presented for the comparison of three conditions, as is shown by the attached file. I usually perform the test from the GUI of EEGLAB. Could anyone tell me how I should understand the test results? Thank you in advance.

******************************************
Shingo Tokimoto, Ph.D.
in Linguistics and Psychology
Department of Foreign Languages
Mejiro University
4-31-1, Naka-Ochiai, Shinjuku, Tokyo,
161-8539, Japan
tokimoto at mejiro.ac.jp<mailto:tokimoto at mejiro.ac.jp>
******************************************

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170907/21d5ec3d/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ERSP_sample.jpg
Type: image/jpeg
Size: 126118 bytes
Desc: not available
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170907/21d5ec3d/attachment-0001.jpg>

------------------------------

Message: 3
Date: Wed, 6 Sep 2017 18:25:54 +0200
From: STEPHAN MORATTI <smoratti at psi.ucm.es<mailto:smoratti at psi.ucm.es>>
To: SARA RODRIGUEZ FREGENAL <srodri10 at ucm.es<mailto:srodri10 at ucm.es>>, FieldTrip discussion
                list <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>>
Subject: Re: [FieldTrip] Learning agreementbuybr 8
Message-ID:
                <CAE20z9KE=FQERSC+-EPn=7cNrk53NpdWgh=gUrTg=64t5-MoxA at mail.gmail.com<mailto:CAE20z9KE=FQERSC+-EPn=7cNrk53NpdWgh=gUrTg=64t5-MoxA at mail.gmail.com>>
Content-Type: text/plain; charset="utf-8"

C ck

El 5 sept. 2017 14:37, "SARA RODRIGUEZ FREGENAL" <srodri10 at ucm.es<mailto:srodri10 at ucm.es>> escribi?:

Buenos d?as Stephan,

Soy una de tus tuteladas del Erasmus en Glasgow. Tuve que cambiar unas
cosas en el learning agreement y me piden que me lo vuelvas a firmar.
?Ser?as tan amable de envi?rmelo firmado?

Gracias y perd?n por las molestias,
Sara
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170906/0ed6c438/attachment.html>

------------------------------

_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl>
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip

End of fieldtrip Digest, Vol 82, Issue 8
****************************************

_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl>
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170907/a37c644c/attachment.html>


More information about the fieldtrip mailing list