<div dir="ltr">Dear List, <br><br>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.<br><br>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'). <div><div><br></div><div><b>I'm looking to use ft_freqstatistics to do the following:</b><br></div><div><div><br></div><div><b>1-</b> For one channel, process each time-point at every frequency of interest, taking the power at that moment for each trial (<font face="arial, sans-serif">e.g.</font><font face="monospace"> data.powspctrm(1:53, 1,1,1)</font><font face="arial, sans-serif">, then </font><font face="monospace">data.powspctrm(1:53, 1,1,2)</font>, etc.<span style="font-family:arial,sans-serif">).</span></div><div><br></div><div><b>2-</b> 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.<br><b><br></b></div><div><b>3-</b> Repeat for each time-point and frequency, correcting for multiple comparisons.</div><div><b><br></b></div><div><b>4.</b> Plot the resulting heatmap and mask.</div><div><br></div><div><br></div><div>So, dear List,<b> here are my questions:</b><br><br><b>A: </b>Is what I want to do possible with ft_freqstatistics, or some other function in FieldTrip?<br><b>B: </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.<br><b>C: </b>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.  <br></div><div><br></div><div><br></div><div><br></div><div><b>Following is how the input data is structured, the cfg and the result of the call.</b></div><div><br></div><div>My <b>data </b>looks like this, for each condition :<br><font face="monospace">data:<br>        label: {1×15 cell}            % 15 channels with data<br>       dimord: 'rpt_chan_freq_time'   <br>         freq: [1×57 double]          % from 4 to 60 Hz<br>         time: [1×1000 double]        % one second of data<br>    powspctrm: [53×15×57×1000 double] % 53 trials. Not constant between conditions.<br>          cfg: [1×1 struct]<br></font><div><br></div></div><div>The <b>cfg </b>I use for my call to ft_freqstatistics is the following:<br><font face="monospace"><br></font></div><div><font face="monospace">             channel: 'Ch:1 PMd idES:377'<br>             latency: 'all'<br>           frequency: 'all'<br>         avgoverchan: 'no'<br>         avgovertime: 'no'<br>         avgoverfreq: 'no'</font></div><div><div><font face="monospace">          resampling: 'permutation'</font></div><div></div><font face="monospace">           parameter: 'powspctrm'<br>              design: [2×106 double]<br>              method: 'montecarlo'<br>    numrandomization: 1000<br>           statistic: 'depsamplesT'<br>               alpha: 0.025<br>                ivar: 1<br>            correctm: 'bonferroni'<br><br></font>The <b>design </b>looks like this, where the first row represents condition type and the second, trials:<br><font face="monospace"><br>     1   1   1   ...    1     1     1     2     2     2   ...   

 2     2     2  <br>     1   2   3   ...   51    52    53     1     2     3   ...   51    52    53  </font></div><div><font face="arial, sans-serif"><br>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). </font></div><div><font face="arial, sans-serif"><br><br></font></div><div><font face="arial, sans-serif">When I call ft_freqstatistics, the result looks like this:</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="monospace">the call to "ft_selectdata" took 0 seconds<br>using "ft_statistics_montecarlo" for the statistical testing<br>using "ft_statfun_depsamplesT" for the single-sample statistics<br>constructing randomized design<br>total number of measurements     = 106<br>total number of variables        = 2<br>number of independent variables  = 1<br>number of unit variables         = 1<br>number of within-cell variables  = 0<br>number of control variables      = 0<br>using a permutation resampling approach<br>repeated measurement in variable 2 over 53 levels<br>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 <br>computing statistic<br>estimated time per randomization is 0.00 seconds<br>computing statistic 1000 from 1000<br><br>performing Bonferroni correction for multiple comparisons<br>the returned probabilities are uncorrected, the thresholded mask is corrected<br>the call to "ft_freqstatistics" took 4 seconds<br><br>stat = <br><br>  struct with fields:<br><br>       prob: [1×57×0 double]<br>    cirange: [1×57×0 double]<br>       mask: [1×57×0 logical]<br>       stat: [1×57×0 double]<br>        ref: [1×57×0 double]<br>     dimord: 'chan_freq_time'<br>       freq: [1×57 double]<br>      label: {'Ch:1 PMd idES:377'}<br>       time: [1×0 double]<br>        cfg: [1×1 struct]</font><br><br></div><div>Since stat is basically an structure of empty matrices, I figure something's wrong. <br><br><br><br><br>Thank you all very much,<br><br>Regards, <br><br>Thomas Lusignan<br><br><br></div><div><br></div><div>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). </div></div></div></div>