[FieldTrip] ft_freqstatistics to find significantly different time samples

Stephen Whitmarsh stephen.whitmarsh at gmail.com
Wed Nov 20 18:25:54 CET 2019


Hi Thomas,

Yes, it's just as described in the tutorials
<http://www.fieldtriptoolbox.org/tutorial/>, e.g here
<http://www.fieldtriptoolbox.org/tutorial/timefrequencyanalysis/> and here
<http://www.fieldtriptoolbox.org/tutorial/cluster_permutation_freq/>

Cheers,
Stephen

Op wo 20 nov. 2019 om 16:57 schreef Thomas Lusignan <
thomas.lusignan at gmail.com>:

> Hi FieldTrippers!
>
> Quick question: Is it possible to* use ft_freqstatistics* to compare two
> groups of time-frequency representations,* time-sample by time-sample*
> (and for each frequency of interest)?
>
> If is is possible, *how should my design matrix look like* for comparing,
> say: two conditions, one with five trials and one with 6 trials, each trial
> having 100 time-samples?
>
> Thank you all !
>
> Regards,
>
> Thomas Lusignan
> Master's student
> Université de Montréal
>
> Le lun. 11 nov. 2019 à 15:24, Thomas Lusignan <thomas.lusignan at gmail.com>
> a écrit :
>
>> Dear List,
>>
>> I am Thomas, a Master's student in Paul Cisek's lab in Montréal. I work
>> on monkey local field potentials and spike data recorded during a
>> decision-making task. This means as of now I have only one subject, but
>> hundreds of sessions.
>>
>> I figured out how to plot time-frequency representations of each
>> condition (i.e. trial types). However, I would like to statistically
>> compare conditions together to see if each time-frequency point is
>> significantly different between conditions. I've already used
>> ft_preprocessing and ft_freqanalysis on the data to get power spectra (with
>> cfg.keeptrials = 'yes').
>>
>> *I'm looking to use ft_freqstatistics to do the following:*
>>
>> *1-* For one channel, process each time-point at every frequency of
>> interest, taking the power at that moment for each trial (e.g.
>> data.powspctrm(1:53, 1,1,1), then data.powspctrm(1:53, 1,1,2), etc.).
>>
>> *2-* Use permutations to perform a t-test to see if the average of the
>> points in one condition is different from the average of the second
>> condition.
>>
>> *3-* Repeat for each time-point and frequency, correcting for multiple
>> comparisons.
>>
>> *4.* Plot the resulting heatmap and mask.
>>
>>
>> So, dear List,* here are my questions:*
>>
>> *A: *Is what I want to do possible with ft_freqstatistics, or some other
>> function in FieldTrip?
>> *B: *If it is, what am I doing wrong? I'm guessing it has to do with the
>> design matrix, but I don't know how to fix it.
>> *C: *If it works, can I compare distributions of different sizes (i.e.:
>> a condition with 53 trials vs a condition with 85 trials)? I *could*
>> randomly select only a certain number of trials so that sample sizes are
>> equal, but would rather not.
>>
>>
>>
>> *Following is how the input data is structured, the cfg and the result of
>> the call.*
>>
>> My *data *looks like this, for each condition :
>> data:
>>         label: {1×15 cell}            % 15 channels with data
>>        dimord: 'rpt_chan_freq_time'
>>          freq: [1×57 double]          % from 4 to 60 Hz
>>          time: [1×1000 double]        % one second of data
>>     powspctrm: [53×15×57×1000 double] % 53 trials. Not constant between
>> conditions.
>>           cfg: [1×1 struct]
>>
>> The *cfg *I use for my call to ft_freqstatistics is the following:
>>
>>              channel: 'Ch:1 PMd idES:377'
>>              latency: 'all'
>>            frequency: 'all'
>>          avgoverchan: 'no'
>>          avgovertime: 'no'
>>          avgoverfreq: 'no'
>>           resampling: 'permutation'
>>            parameter: 'powspctrm'
>>               design: [2×106 double]
>>               method: 'montecarlo'
>>     numrandomization: 1000
>>            statistic: 'depsamplesT'
>>                alpha: 0.025
>>                 ivar: 1
>>             correctm: 'bonferroni'
>>
>> The *design *looks like this, where the first row represents condition
>> type and the second, trials:
>>
>>      1   1   1   ...    1     1     1     2     2     2   ...    2     2
>>     2
>>      1   2   3   ...   51    52    53     1     2     3   ...   51    52
>>    53
>>
>> I'm pretty sure this is not the right design for my needs, as
>> permutations only switch between "corresponding" trials (e.g. index 1 with
>> 54, 2 with 55 and so on).
>>
>>
>> When I call ft_freqstatistics, the result looks like this:
>>
>> the call to "ft_selectdata" took 0 seconds
>> using "ft_statistics_montecarlo" for the statistical testing
>> using "ft_statfun_depsamplesT" for the single-sample statistics
>> constructing randomized design
>> total number of measurements     = 106
>> total number of variables        = 2
>> number of independent variables  = 1
>> number of unit variables         = 1
>> number of within-cell variables  = 0
>> number of control variables      = 0
>> using a permutation resampling approach
>> repeated measurement in variable 2 over 53 levels
>> number of repeated measurements in each level is 2 2 2 2 2 2 2 2 2 2 2 2
>> 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
>> 2 2 2
>> computing statistic
>> estimated time per randomization is 0.00 seconds
>> computing statistic 1000 from 1000
>>
>> performing Bonferroni correction for multiple comparisons
>> the returned probabilities are uncorrected, the thresholded mask is
>> corrected
>> the call to "ft_freqstatistics" took 4 seconds
>>
>> stat =
>>
>>   struct with fields:
>>
>>        prob: [1×57×0 double]
>>     cirange: [1×57×0 double]
>>        mask: [1×57×0 logical]
>>        stat: [1×57×0 double]
>>         ref: [1×57×0 double]
>>      dimord: 'chan_freq_time'
>>        freq: [1×57 double]
>>       label: {'Ch:1 PMd idES:377'}
>>        time: [1×0 double]
>>         cfg: [1×1 struct]
>>
>> Since stat is basically an structure of empty matrices, I figure
>> something's wrong.
>>
>>
>>
>>
>> Thank you all very much,
>>
>> Regards,
>>
>> Thomas Lusignan
>>
>>
>>
>> P.S.: My neurophysiological data is stored in a custom SQL database,
>> which means that I have no .plx files to import (and therefore no headers,
>> which makes using FieldTrip a little less straightforward). My data
>> structures therefore come from a function I built which gets the data and
>> organizes it correctly (or so I think, but I might be wrong).
>>
> _______________________________________________
> fieldtrip mailing list
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> https://doi.org/10.1371/journal.pcbi.1002202
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20191120/41132013/attachment.html>


More information about the fieldtrip mailing list