[FieldTrip] Problem with ft_timelockstatistics, within subject comparison of two conditions (Clara A. Scholl)

barbara.schorr at uni-ulm.de barbara.schorr at uni-ulm.de
Wed Oct 8 13:31:46 CEST 2014


Dear Clara,

thank you for your comments.

I ran it as an independent samples Test (it is true, that this is the  
correct way).
I also changed the design matrix to
cfg.design = [ones(1,size(targetclean_tlt.trial,1))  
2*ones(1,size(standardclean_tlt.trial,1))]

It works and there are no more error messages. However, when it  
displays the progress of the calculation there is the field: total  
number of observations, total number of variables and number of  
independent variables. It recognizes correctly that there are 185  
trials in total (both conditions together). But it only counts 1  
variable and 1 independent variable. Shouldn't it recognize 2  
variables as I have 2 conditions?

Best regards,
Barbara


Zitat von fieldtrip-request at science.ru.nl:

> Send fieldtrip mailing list submissions to
> 	fieldtrip at science.ru.nl
>
> To subscribe or unsubscribe via the World Wide Web, visit
> 	http://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
>
> You can reach the person managing the list at
> 	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. Problem with ft_timelockstatistics,	within subject comparison
>       of	two conditions (barbara.schorr at uni-ulm.de)
>    2. Re: Problem with ft_timelockstatistics, within subject
>       comparison of two conditions (Clara A. Scholl)
>    3. Re: help for statistics on ERD/ERS (Tzvetan Popov)
>    4. Re: help for statistics on ERD/ERS (Giuly)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 07 Oct 2014 15:42:53 +0200
> From: barbara.schorr at uni-ulm.de
> To: fieldtrip at science.ru.nl
> Subject: [FieldTrip] Problem with ft_timelockstatistics,	within
> 	subject comparison of	two conditions
> Message-ID: <20141007154253.1acx2qfvso4k4so4 at imap.uni-ulm.de>
> Content-Type: text/plain;	charset=ISO-8859-1;	DelSp="Yes";
> 	format="flowed"
>
> Dear fieldtripers,
>
> I would like to compare to conditions of an auditory oddball paradigm
> (target tones and standard tones).
> For the identification of the electrodes which show the biggest P300,
> I would like to use cluster based permutation test, i.e. I want to use
> ft_timelockstatistics, to identify the clusters with a significant
> difference between the target and the standardtones.
> Important: I don't want to do a group statistic, but I want to compare
> these two conditions within each subject, to identify interesting
> clusters for each subject separately.
>
>
> I wrote the script following the tutorials on the fieldtrip homepage.
>
> I already wrote a code but it does not work:
> %%
>
> for i = 3:10 % subject number
>      mypfad = 'G:\BackUp07.07.14_DatenPrepr\Daten1\P300'
>      cd(mypfad)
>      cd Kontrollen;
>      List = dir
>      cd (List(i).name);
>      for j = 1:4 %session number
>          cd (mypfad);
>          cd Kontrollen;
>          List = dir
>          cd (List(i).name);
>          eval(['cd M' num2str(j)]);
>          load cleandata_tlt; %preprocessed timelocked data
> standardclean_tlt  and targetclean_tlt
>
>          cfg = []
>          cfg.neighbourdist = .09;
>          cfg.layout= ulmegilay;
>          cfg.method = 'distance';
>
>          Neighbours = ft_prepare_neighbours(cfg, standardclean_tlt)
>
>          cfg = []
>          cfg.method = 'montecarlo' ; %significance probability
>          cfg.statistic = 'ft_statfun_depsamplesT'
>          cfg.correctm = 'cluster'
>          cfg.clusteralpha = 0.05 %alpha level of the sample specific
> test statistic that will
>                                  % be used for thresholding
>          cfg.clusterstatistic = 'maxsum'
>          cfg.minnbchan = 4
>          cfg.latency = [0.25 0.8]
>          cfg.neighbours = Neighbours
>          cfg.tail = 0
>          cfg.clustertail = 0
>          cfg.alpha = 0.025
>          cfg.numrandomization = 1000
>
>          design = [ones(size(targetclean_tlt.trial,1),1);
> 2*ones(size(standardclean_tlt.trial,1),1)]';
>          design([1:size(targetclean_tlt.trial)
> 1:size(standardclean_tlt.trial,1)])
>
>
>          cfg.design = design
>          cfg.ivar = [ones(size(targetclean_tlt.trial,1),1);
> 2*ones(size(standardclean_tlt.trial,1),1)]'
>          cfg.uvar = [1:size(targetclean_tlt.trial)
> 1:size(standardclean_tlt.trial,1)]
>
>          tlt_statsnew = ft_timelockstatistics(cfg, targetclean_tlt,
> standardclean_tlt )
>
>          cd 'G:\BackUp07.07.14_DatenPrepr\Daten1\P300';
>          cd Kontrollen;
>          List2 = dir
>          cd (List2(i).name);
>          eval(['cd M' num2str(j)]);
>          save statnew tlt_statsnew
>
>      end
> end
>
>
> This is what gets displayed while running the script:
>
> selected 245 channels
> selected 139 time bins
> selected 1 frequency bins
> using "ft_statistics_montecarlo" for the statistical testing
> using "ft_statfun_depsamplesT" for the single-sample statistics
> constructing randomized design
> total number of measurements     = 189
> total number of variables        = 1
> number of independent variables  = 189
> number of unit variables         = 189
> number of within-cell variables  = 0
> number of control variables      = 0
> using a permutation resampling approach
>
> Then, this error occurs:
>
> Error using resampledesign (line 168)
> A within-units shuffling requires a at least one unit variable and at least
> one independent variable
>
> Error in ft_statistics_montecarlo (line 241)
> resample = resampledesign(cfg, design);
>
> Error in statistics_wrapper (line 310)
>      [stat, cfg] = statmethod(cfg, dat, design);
>
> Error in ft_timelockstatistics (line 113)
> [stat, cfg] = statistics_wrapper(cfg, varargin{:});
>
> I have no clue where I made a mistake. I have unit variables and
> independent variables (189 if I understand it correctly).
> Is there anything I am missing? Any additional information or is the
> design matrix wrong?
>
>
> I really appreciate your help.
>
> Best regards,
> Barbara
>
>
>
>
> Barbara Schorr, MSc
> Clinical and Biological Psychology
> University of Ulm
> Albert-Einstein-Allee 47
> 89069 Ulm
>
>
>
>
>
> ------------------------------
>
> Message: 2
> Date: Tue, 7 Oct 2014 09:55:36 -0400
> From: "Clara A. Scholl" <clara.scholl at gmail.com>
> To: FieldTrip discussion list <fieldtrip at science.ru.nl>
> Subject: Re: [FieldTrip] Problem with ft_timelockstatistics, within
> 	subject comparison of two conditions
> Message-ID:
> 	<CAAHOyr7MU6npw9U4Wqkoo7OXxthQmsTrjBroWcxLe6qTeSkC=g at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Dear Barbara,
>
> Just three thoughts:
>
> 1) Should cfg.ivar and cfg.uvar both be single values, i.e. the dimension
> of the design matrix that contains the independent and unit variables?
> Then you'd have cfg.ivar=1 and cfg.uvar=2 (or vise versa, depending on the
> design matrix).
>
> 2) I think the design matrix itself might be off, right now it just seems
> to have dimensions of 1 x (# targets+standards).  It should have a second
> dimension which counts the # of trials, something like:
>
> design(1,:) = [ones(size(targetclean_tlt.trial,1),1);
> 2*ones(size(standardclean_tlt.trial,1),1)]';
>  design(2,:)= ([1:size(targetclean_tlt.trial) 1:size(standardclean_tlt.trial
> ,1)])
>
> 3) Since this is a design where each trial is an observation, I think you
> should be using indepsamplesT for cfg.statistic (the trials aren't paired
> and there aren't necessarily identical #'s of trials for each condition.
>
> What do you think?
> Respectfully,
> Clara
>
>
> On Tue, Oct 7, 2014 at 9:42 AM, <barbara.schorr at uni-ulm.de> wrote:
>
>> Dear fieldtripers,
>>
>> I would like to compare to conditions of an auditory oddball paradigm
>> (target tones and standard tones).
>> For the identification of the electrodes which show the biggest P300, I
>> would like to use cluster based permutation test, i.e. I want to use
>> ft_timelockstatistics, to identify the clusters with a significant
>> difference between the target and the standardtones.
>> Important: I don't want to do a group statistic, but I want to compare
>> these two conditions within each subject, to identify interesting clusters
>> for each subject separately.
>>
>>
>> I wrote the script following the tutorials on the fieldtrip homepage.
>>
>> I already wrote a code but it does not work:
>> %%
>>
>> for i = 3:10 % subject number
>>     mypfad = 'G:\BackUp07.07.14_DatenPrepr\Daten1\P300'
>>     cd(mypfad)
>>     cd Kontrollen;
>>     List = dir
>>     cd (List(i).name);
>>     for j = 1:4 %session number
>>         cd (mypfad);
>>         cd Kontrollen;
>>         List = dir
>>         cd (List(i).name);
>>         eval(['cd M' num2str(j)]);
>>         load cleandata_tlt; %preprocessed timelocked data
>> standardclean_tlt  and targetclean_tlt
>>
>>         cfg = []
>>         cfg.neighbourdist = .09;
>>         cfg.layout= ulmegilay;
>>         cfg.method = 'distance';
>>
>>         Neighbours = ft_prepare_neighbours(cfg, standardclean_tlt)
>>
>>         cfg = []
>>         cfg.method = 'montecarlo' ; %significance probability
>>         cfg.statistic = 'ft_statfun_depsamplesT'
>>         cfg.correctm = 'cluster'
>>         cfg.clusteralpha = 0.05 %alpha level of the sample specific test
>> statistic that will
>>                                 % be used for thresholding
>>         cfg.clusterstatistic = 'maxsum'
>>         cfg.minnbchan = 4
>>         cfg.latency = [0.25 0.8]
>>         cfg.neighbours = Neighbours
>>         cfg.tail = 0
>>         cfg.clustertail = 0
>>         cfg.alpha = 0.025
>>         cfg.numrandomization = 1000
>>
>>         design = [ones(size(targetclean_tlt.trial,1),1);
>> 2*ones(size(standardclean_tlt.trial,1),1)]';
>>         design([1:size(targetclean_tlt.trial) 1:size(standardclean_tlt.
>> trial,1)])
>>
>>
>>         cfg.design = design
>>         cfg.ivar = [ones(size(targetclean_tlt.trial,1),1);
>> 2*ones(size(standardclean_tlt.trial,1),1)]'
>>         cfg.uvar = [1:size(targetclean_tlt.trial) 1:size(standardclean_tlt.
>> trial,1)]
>>
>>         tlt_statsnew = ft_timelockstatistics(cfg, targetclean_tlt,
>> standardclean_tlt )
>>
>>         cd 'G:\BackUp07.07.14_DatenPrepr\Daten1\P300';
>>         cd Kontrollen;
>>         List2 = dir
>>         cd (List2(i).name);
>>         eval(['cd M' num2str(j)]);
>>         save statnew tlt_statsnew
>>
>>     end
>> end
>>
>>
>> This is what gets displayed while running the script:
>>
>> selected 245 channels
>> selected 139 time bins
>> selected 1 frequency bins
>> using "ft_statistics_montecarlo" for the statistical testing
>> using "ft_statfun_depsamplesT" for the single-sample statistics
>> constructing randomized design
>> total number of measurements     = 189
>> total number of variables        = 1
>> number of independent variables  = 189
>> number of unit variables         = 189
>> number of within-cell variables  = 0
>> number of control variables      = 0
>> using a permutation resampling approach
>>
>> Then, this error occurs:
>>
>> Error using resampledesign (line 168)
>> A within-units shuffling requires a at least one unit variable and at least
>> one independent variable
>>
>> Error in ft_statistics_montecarlo (line 241)
>> resample = resampledesign(cfg, design);
>>
>> Error in statistics_wrapper (line 310)
>>     [stat, cfg] = statmethod(cfg, dat, design);
>>
>> Error in ft_timelockstatistics (line 113)
>> [stat, cfg] = statistics_wrapper(cfg, varargin{:});
>>
>> I have no clue where I made a mistake. I have unit variables and
>> independent variables (189 if I understand it correctly).
>> Is there anything I am missing? Any additional information or is the
>> design matrix wrong?
>>
>>
>> I really appreciate your help.
>>
>> Best regards,
>> Barbara
>>
>>
>>
>>
>> Barbara Schorr, MSc
>> Clinical and Biological Psychology
>> University of Ulm
>> Albert-Einstein-Allee 47
>> 89069 Ulm
>>
>>
>>
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:   
> <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20141007/64be64b4/attachment-0001.html>
>
> ------------------------------
>
> Message: 3
> Date: Tue, 7 Oct 2014 21:07:37 +0200
> From: Tzvetan Popov <tzvetan.popov at uni-konstanz.de>
> To: FieldTrip discussion list <fieldtrip at science.ru.nl>
> Subject: Re: [FieldTrip] help for statistics on ERD/ERS
> Message-ID: <D25CE622-A81C-493D-8905-8536BB51023C at uni-konstanz.de>
> Content-Type: text/plain; charset=windows-1252
>
> Hi Giulia,
>
>
>> Dear Fieldtrippers
>> I'm writing to ask you some help on data in a single subject study.
>> I did a time frequency decomposition and I would like to do a   
>> statistic to state whether the average TFR has significant ERD/ERS   
>> or not.
>> I'm not sure how to proceed
> What you are referring to is a ?between trial experiment? which is   
> described in this tutorial:
> http://fieldtrip.fcdonders.nl/tutorial/cluster_permutation_freq
> One possible way to go is to compute the TFR?s with cfg.keeptrials =  
>  ?yes?. Next you?d treat the baseline and the task interval as two   
> conditions by separating them using ft_selectdata. After this you   
> can compute the statistical comparison in a similar fashion as   
> described in the tutorial.
> Keep in mind that you have to cut the data into equal lengths.   
> Please have a look at this post :
> http://mailman.science.ru.nl/pipermail/fieldtrip/2007-July/001303.html
>> , as a first step I compared the single trial baseline with the   
>> respective event, with a t-test for each condition and band of   
>> interest but I'm not really sure if this is enough and anyway if it  
>>  is the correct way.
> Also please type ?actvsblT? in the search bar and then click on   
> ?Search the FieldTrip mailing list?. There you?ll find some info   
> about this.
>
> best
> tzvetan
>
>
>
>
> ------------------------------
>
> Message: 4
> Date: Wed, 08 Oct 2014 10:45:23 +0200
> From: Giuly <giulia.rizza at tiscali.it>
> To: FieldTrip discussion list <fieldtrip at science.ru.nl>
> Subject: Re: [FieldTrip] help for statistics on ERD/ERS
> Message-ID: <eeebb8a2bf90ed8099aea3a3e21a7a38 at tiscali.it>
> Content-Type: text/plain; charset="utf-8"
>
>   Hi Tzvetan
> Thank you so much for your reply
> I will try these
> functions keeping in mind your explanation
> Best regards
> Giulia
>
> Il
> 07.10.2014 21:07 Tzvetan Popov ha scritto:
>
>> Hi Giulia,
>>
>>> Dear
> Fieldtrippers I'm writing to ask you some help on data in a single
> subject study. I did a time frequency decomposition and I would like to
> do a statistic to state whether the average TFR has significant ERD/ERS
> or not. I'm not sure how to proceed
>>
>> What you are referring to is a
> "between trial experiment" which is described in this tutorial:
>>
> http://fieldtrip.fcdonders.nl/tutorial/cluster_permutation_freq [1]
>>
> One possible way to go is to compute the TFR's with cfg.keeptrials =
> 'yes'. Next you'd treat the baseline and the task interval as two
> conditions by separating them using ft_selectdata. After this you can
> compute the statistical comparison in a similar fashion as described in
> the tutorial.
>> Keep in mind that you have to cut the data into equal
> lengths. Please have a look at this post :
>>
> http://mailman.science.ru.nl/pipermail/fieldtrip/2007-July/001303.html
> [2]
>>
>>> , as a first step I compared the single trial baseline with
> the respective event, with a t-test for each condition and band of
> interest but I'm not really sure if this is enough and anyway if it is
> the correct way.
>>
>> Also please type "actvsblT" in the search bar and
> then click on "Search the FieldTrip mailing list". There you'll find
> some info about this.
>>
>> best
>> tzvetan
>>
>>
> _______________________________________________
>> fieldtrip mailing
> list
>> fieldtrip at donders.ru.nl [3]
>>
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip [4]
>
>
>
>
> Scopri istella, il nuovo motore per il web italiano.
> Istella garantisce risultati di qualit? e la possibilit? di   
> condividere, in modo semplice e veloce, documenti, immagini, audio e  
>  video.
> Usa istella, vai su http://www.istella.it?wtk=amc138614816829636
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:   
> <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20141008/ff2ad283/attachment-0001.html>
>
> ------------------------------
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
> End of fieldtrip Digest, Vol 47, Issue 6
> ****************************************
>



Barbara Schorr, MSc
Clinical and Biological Psychology
University of Ulm
Albert-Einstein-Allee 47
89069 Ulm






More information about the fieldtrip mailing list