<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>Arjen et al,</div><div><br></div><div>I have the following output data from regressconfound pertaining to one block of data.</div><div><br></div><div><div>hpicompfiltdata = </div><div><br></div><div> avg: [306x1500 double]</div><div> var: [306x1500 double]</div><div> time: [1x1500 double]</div><div> dof: [306x1500 double]</div><div> label: {306x1 cell}</div><div> trial: [59x306x1500 double]</div><div> dimord: 'rpt_chan_time'</div><div> trialinfo: [59x1 double]</div><div> cfg: [1x1 struct]</div><div> beta: [37x306x1500 double]</div></div><div><br></div><div>Since I have 4 blocks for each subject, I appended them using ft_appenddata, and using ft_timelockanalysis (mentioning appropriate cfg.trial and <span style="font-family: Courier;">cfg.keeptrials=‘yes’;</span>) I split the data into 2 conditions timelock_cond1 (shown below) and timelock_cond2, retaining only 204 gradiometers ( i suppose I am not supposed to use ft_combineplanar at this level since it would distort the results).</div><div><br></div><div><div>timelock_cond1 = </div><div><br></div><div> avg: [204x1500 double]</div><div> var: [204x1500 double]</div><div> time: [1x1500 double]</div><div> dof: [204x1500 double]</div><div> label: {204x1 cell}</div><div> trial: [143x204x1500 double]</div><div> dimord: 'rpt_chan_time'</div><div> trialinfo: [143x1 double]</div><div> cfg: [1x1 struct]</div></div><div><br></div><div><br></div><div><font face="Courier">Then these are the steps I did, per your suggestion.</font></div><div><font face="Courier"><br></font></div><div><span style="font-family: Courier;">1. I gathered all the time lock (from above step) for all subjects in a cell matrix, timelock_cond1{:} and timelock_cond2{:}</span></div><div><font face="Courier"><br></font></div><div><font face="Courier">3. Then I ran first level stats for each subject, with cfg.statistic= indepsamplesT and cfg.method=‘analytic’; cfg.design as you suggested, and rest of cfg.</font></div><div><font face="Courier"><br></font></div><div><div style="margin: 0px;"><font face="Courier">for sj = 1: size(subj,2)</font></div></div><div><div style="margin: 0px;"><font face="Courier">stat1{sj}=first_level_stats(timelock_cond1{sj},timelock_cond2{:});</font></div></div><div><div style="margin: 0px;"><font face="Courier">end</font></div></div><div style="margin: 0px;"><font face="Courier"><br></font></div><div style="margin: 0px;"><font face="Courier">4. Then, I did timelockgrandaverage</font></div><div style="margin: 0px;"><font face="Courier"><br></font></div><div style="margin: 0px;"><div style="margin: 0px; font-family: Courier;">cfg.keepindividual = 'yes';</div><div style="margin: 0px; font-family: Courier;">cfg.parameter = 'stat';</div><div style="margin: 0px; font-family: Courier;">stat2=ft_timelockgrandaverage(cfg,stat1{:});</div><div><br></div><div>5. Created a dummy variable just like stat2 in the above step and replaced the field ‘individual’ with zeros</div><div><br></div><div><div style="margin: 0px; font-family: Courier;">dummy2=stat2;</div><div style="margin: 0px; font-family: Courier;">dummy2.individual=zeros(size(stat2.individual));</div></div><div style="margin: 0px; font-family: Courier;"><br></div><div style="margin: 0px; font-family: Courier;">6. Finally, ran the second level stats, with cfg. statistic = ‘depsamplesT’; cfg.method=‘montecarlo’; and rest of cfg.</div><div style="margin: 0px; font-family: Courier;"><br></div><div style="margin: 0px; font-family: Courier;"><div style="margin: 0px;"> stat = ft_timelockstatistics(cfg, stat2, dummy2);</div><div style="margin: 0px;"><br></div><div style="margin: 0px;"><br></div><div style="margin: 0px;"><br></div><div style="margin: 0px;"><span style="font-size: 14px;">However, the problem is, whatever significance I found earlier (i.e. by comparing means rather than t-statistic) doesn’t test significant now. I thought it might get better by doing this, but seems to get worse. Please correct me if I am doing anything wrong.</span></div><div style="margin: 0px;"><br></div><div style="margin: 0px;">Thanks,</div><div style="margin: 0px;">Raghavan</div><div style="margin: 0px;"><br></div><div style="margin: 0px;"><br></div><div><br></div></div><div><br></div></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><pre>What you described in your reply to me just now, calling
ft_timelockstatistics at the subject level to calculate descriptives, still
effectively reduces each subject to one "datapoint" -- the difference
between conditions of the selected t-descriptive for that subject. I
believe I understand how to do that, and how to then do nonparametric
shuffle testing at the between-subjects level for the signfiicance of that
within-subjects descriptive/difference.
>><i> Ok. That's indeed the procedure I tried to outline.
</i>
In your earlier reply to Raghavan, it sounded like you were suggesting
pooling the trials themselves between subjects (that is, all subjects'
trials go into one big "bucket"), with the trial-to-trial variance having
been removed via ft_regressconfound, *then* calling the ft_statistics
functions on this single large "bucket" of trials. Have I misunderstood
your suggestion?
>><i> I might have not been clear there then. I was meant to say that one
</i>could use ft_regressconfound on trials of two (or more) conditions combined
of a single subject, prior to calculating the single subject t-descriptive
(using ft_xxxstatistics). This allows one to compute a 'cleaner' t-score,
or at least provide a good case that head movement did not differentially
influence activity levels in the separate conditions. It was not related to
pooling trials between subjects.
2014-02-21 16:14 GMT+01:00 Alik Widge <<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip">alik.widge at gmail.com</a>>:
><i> I don't *think* I'm asking about how to do second-order analysis, unless I
</i>><i> have missed something important. I did read the link/FAQ when I was working
</i>><i> on this last week, and that seems different than the question I am asking.
</i>><i>
</i>><i> What you described in your reply to me just now, calling
</i>><i> ft_timelockstatistics at the subject level to calculate descriptives, still
</i>><i> effectively reduces each subject to one "datapoint" -- the difference
</i>><i> between conditions of the selected t-descriptive for that subject. I
</i>><i> believe I understand how to do that, and how to then do nonparametric
</i>><i> shuffle testing at the between-subjects level for the signfiicance of that
</i>><i> within-subjects descriptive/difference.
</i>><i>
</i>><i> In your earlier reply to Raghavan, it sounded like you were suggesting
</i>><i> pooling the trials themselves between subjects (that is, all subjects'
</i>><i> trials go into one big "bucket"), with the trial-to-trial variance having
</i>><i> been removed via ft_regressconfound, *then* calling the ft_statistics
</i>><i> functions on this single large "bucket" of trials. Have I misunderstood
</i>><i> your suggestion?
</i>><i>
</i>><i> Alik
</i>><i>
</i>><i> Alik Widge
</i>><i> <a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip">alik.widge at gmail.com</a>
</i>><i> (206) 866-5435
</i>><i>
</i>><i>
</i>><i>
</i>><i> On Fri, Feb 21, 2014 at 9:53 AM, Stolk, A. (Arjen) <
</i>><i> <a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip">a.stolk at fcdonders.ru.nl</a>> wrote:
</i>><i>
</i>>><i> Dear Alik,
</i>>><i>
</i>>><i> If I am correct, you're asking how to create subject-level
</i>>><i> t-descriptives, mentioned in the previous post? A quick answer would be to
</i>>><i> perform an indepedent t-test ( cfg.statistic = indepsamplesT; ) using
</i>>><i> ft_timelockstatistics (although you're not really 'testing' here, but only
</i>>><i> interested in that t-descriptive), in which trials are the unit of
</i>>><i> observations ( cfg.design = [ones(1, ntrls_conditionA) 2*ones(1,
</i>>><i> ntrls_conditionB)]; ). Note that since an indepedent t-test tests for
</i>>><i> differences of the means of two conditions, it won't fail on unequal number
</i>>><i> of observations across the conditions (unlike a dependent/paired t-test).
</i>>><i>
</i>>><i> Hope this gets you kickstarted for the moment. I found a previous
</i>>><i> mail-conversation that goes more into detail, providing more overview of
</i>>><i> the steps involved:
</i>>><i> <a href="http://mailman.science.ru.nl/pipermail/fieldtrip/2011-November/004539.html">http://mailman.science.ru.nl/pipermail/fieldtrip/2011-November/004539.html</a>
</i>>><i> More useful documentation:
</i>>><i>
</i>>><i> <a href="http://fieldtrip.fcdonders.nl/faq/what_is_the_idea_behind_statistical_inference_at_the_second-level">http://fieldtrip.fcdonders.nl/faq/what_is_the_idea_behind_statistical_inference_at_the_second-level</a>
</i>>><i>
</i>>><i> Yours,
</i>>><i> Arjen
</i>>><i>
</i>>><i> ------------------------------
</i>>><i>
</i>>><i> *Van: *"Alik Widge" <<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip">alik.widge at gmail.com</a>>
</i>>><i> *Aan: *"FieldTrip discussion list" <<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip">fieldtrip at science.ru.nl</a>>
</i>>><i> *Verzonden: *Vrijdag 21 februari 2014 11:38:10
</i>>><i>
</i>>><i> *Onderwerp: *Re: [FieldTrip] regressconfound and frequency domain
</i>>><i>
</i>>><i> Arjen, what you just described is more or less what I struggled to do
</i>>><i> last week and ultimately gave up as I was unable to figure out how to get
</i>>><i> FT to do it despite much meditation over tutorials and source files. Can
</i>>><i> you elaborate a bit more on what you are saying below -- not the
</i>>><i> ft_regressconfound bit, but the bit about how to get
</i>>><i> ft_statistics_montecarlo and its wrappers to do a trials-level analysis and
</i>>><i> permutation at the whole-group level? Especially, what does one put in
</i>>><i> cfg.design and how does one call the function? Everything I could find in
</i>>><i> the tutorials described the case of doing means at the subject level and
</i>>><i> then permutation of means at the group level, which as you point out is
</i>>><i> underpowered for subtle effects.
</i>>><i>
</i>>><i> My particular situation was timelock-analyzed trials (with
</i>>><i> keeptrials='yes'), but I could not find a way to set up cfg.design that
</i>>><i> did not throw error messages. The thing that really seemed to bother it was
</i>>><i> that there were different numbers of trials in the 2-3 conditions of
</i>>><i> interest, since some had to be removed for excessive artifact.
</i>>><i>
</i>>><i> Thanks for any help,
</i>>><i> Alik
</i>>><i>
</i>>><i> Alik Widge
</i>>><i> <a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip">alik.widge at gmail.com</a>
</i>>><i> (206) 866-5435
</i>>><i>
</i>>><i>
</i>>><i>
</i>>><i> On Fri, Feb 21, 2014 at 3:23 AM, Stolk, A. (Arjen) <
</i>>><i> <a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip">a.stolk at fcdonders.ru.nl</a>> wrote:
</i>>><i>
</i>>>><i> Dear Raghavan,
</i>>>><i>
</i>>>><i> To compute a t-descriptive on subject level freq data, you'll need to
</i>>>><i> use ft_freqstatistics. Have a look here for instance:
</i>>>><i> <a href="http://fieldtrip.fcdonders.nl/tutorial/cluster_permutation_freq">http://fieldtrip.fcdonders.nl/tutorial/cluster_permutation_freq</a>
</i>>>><i>
</i>>>><i> At the subject level, you do not need (non-parametric) cluster
</i>>>><i> permutation testing (Maris & Oostenveld), as you're taking each subject's
</i>>>><i> t-descriptives to the group level. At the group level, you can then test
</i>>>><i> the hypothesis that there's a difference between tasks/conditions (H1) vs.
</i>>>><i> no difference (H0). In order to do so, you'll need to create a dummy
</i>>>><i> variable at the group level, that has the same number of 'subjects', but
</i>>>><i> with zeros in all fields (in your case this will be a .stat field). At the
</i>>>><i> group level, you thus call ft_freqstatistics again. This approach has the
</i>>>><i> advantage that you're more sensitive (as compared to taking each subject's
</i>>>><i> mean to the group level) to effects that are small but consistent over
</i>>>><i> trials in each subject.
</i>>>><i>
</i>>>><i> Arjen
</i>>>><i>
</i>>>><i>
</i>>>><i> ------------------------------
</i>>>><i>
</i>>>><i> *Van: *"Raghavan Gopalakrishnan" <<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip">gopalar.ccf at gmail.com</a>>
</i>>>><i> *Aan: *<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip">fieldtrip at science.ru.nl</a>
</i>>>><i> *Verzonden: *Donderdag 20 februari 2014 23:33:18
</i>>>><i>
</i>>>><i> *Onderwerp: *Re: [FieldTrip] regressconfound and frequency domain
</i>>>><i>
</i>>>><i> Thanks Arjen,
</i>>>><i> Should I use ft_freqdescriptives to compute t descriptives for
</i>>>><i> individual subjects, and then take that to group level instead of mean? If
</i>>>><i> not, what are the other alternatives?
</i>>>><i> Thanks,
</i>>>><i> Raghavan
</i>>>><i>
</i>>>><i> Hi Raghavan, ft_regressconfound run on timelock data seems to return output with avg field. However, ft_regressconfound run on frequency data, does not return average. I see the avg field being removed. Is there a reason? >> Not intentionally, but not an issue either. You could still use ft_freqdescriptives to compute the average for you, but see my comment below. Question - Since ft_regressconfound outputs power spectrum of individual trials - 4D matrix (instead of average), can I simply re-average the power spectrum over trials to see the average power for that subject. Also, I need to run grand average (over subjects) before running statistics. I hope these steps does not distort the data. Please advise. >> Remember that the mean over trials is not affected by your clean-up of trial-by-trial variance due to head movement. Taking each subject's mean (unaffected) to the group level is an approach that will not benefit from your clean-up. In order to benefit from reduced trial-by-trial variance, you'll need a measure that depends on it, e.g. t-descriptive, neural activity-behavior correlation (for taking to the group level). Hope this helps, Arjen ----- Oorspronkelijk bericht -----
</i>>>><i> >* Van: "Raghavan Gopalakrishnan" <gopalar.ccf at <a href="http://gmail.com">gmail.com</a> <<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a>>>
</i>>>><i> *>* Aan: fieldtrip at <a href="http://science.ru.nl">science.ru.nl</a> <<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a>>
</i>>>><i> *>* Verzonden: Donderdag 20 februari 2014 22:12:28
</i>>>><i> *>* Onderwerp: Re: [FieldTrip] regressconfound and frequency domain
</i>>>><i> *>* Arjen,
</i>>>><i> *>* Thanks, I reduced down the time resolution so computation can go
</i>>>><i> *>* faster. Now, m y matrix looks like this
</i>>>><i> *>* hpicomptimefreq =
</i>>>><i> *>* label: {204x1 cell}
</i>>>><i> *>* dimord: 'rpt_chan_freq_time'
</i>>>><i> *>* freq: [1x56 double]
</i>>>><i> *>* time: [1x375 double]
</i>>>><i> *>* powspctrm: [4-D double]
</i>>>><i> *>* cumtapcnt: [59x56 double]
</i>>>><i> *>* cfg: [1x1 struct]
</i>>>><i> *>* trialinfo: [59x1 double]
</i>>>><i> *>* beta: [4-D double]
</i>>>><i> *>* ft_regressconfound run on timelock data seems to return output with
</i>>>><i> *>* avg field. However, ft_regressconfound run on frequency data, does not
</i>>>><i> *>* return average. I see the avg field being removed. Is there a reason?
</i>>>><i> *>* Question - Since ft_regressconfound outputs power spectrum of
</i>>>><i> *>* individual trials - 4D matrix (instead of average), can I simply
</i>>>><i> *>* re-average the power spectrum over trials to see the average power for
</i>>>><i> *>* that subject. Also, I need to run grand average (over subjects) before
</i>>>><i> *>* running statistics. I hope these steps does not distort the data.
</i>>>><i> *>* Please advise.
</i>>>><i> *>* Thanks,
</i>>>><i> *>* Raghavan
</i>>>><i> *>* Date: Wed, 19 Feb 2014 22:58:38 +0100 (CET)
</i>>>><i> *>* From: "Stolk, A. (Arjen)" < a.stolk at <a href="http://fcdonders.ru.nl">fcdonders.ru.nl</a> <<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a>> >
</i>>>><i> *>* To: FieldTrip discussion list < fieldtrip at <a href="http://science.ru.nl">science.ru.nl</a> <<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a>> >
</i>>>><i> *>* Subject: Re: [FieldTrip] regressconfound and frequency domain
</i>>>><i> *>* Message-ID:
</i>>>><i> *>* < 2108167665.5423215.1392847118322.JavaMail.root at <a href="http://sculptor.zimbra.ru.nl">sculptor.zimbra.ru.nl</a> <<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a>>
</i>>>><i> *>* >
</i>>>><i> *>* Content-Type: text/plain; charset="utf-8"
</i>>>><i> *>* Dear Raghavan, Good to hear it's working out for you. A short answer
</i>>>><i> *>* would be 'no'. Reducing the size of your data matrix is likely going
</i>>>><i> *>* to speed up computations. Your time resolution seems pretty high (1500
</i>>>><i> *>* frequency estimations per single trial); do you need that many? Yours,
</i>>>><i> *>* Arjen ----- Oorspronkelijk bericht -----
</i>>>><i> *>* > Van: "Raghavan Gopalakrishnan" < gopalar.ccf at <a href="http://gmail.com">gmail.com</a> <<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a>> >
</i>>>><i> *>* > Aan: fieldtrip at <a href="http://science.ru.nl">science.ru.nl</a> <<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a>>
</i>>>><i> *>* > Verzonden: Woensdag 19 februari 2014 22:01:00
</i>>>><i> *>* > Onderwerp: [FieldTrip] regressconfound and frequency domain
</i>>>><i> *>* > Arjen,
</i>>>><i> *>* > Thanks for answering all my previous questions. I was successfully
</i>>>><i> *>* > able to incorporate head movements to my erf data. As I understand I
</i>>>><i> *>* > have to do this separately for the time frequency data after keeping
</i>>>><i> *>* > individual trials. I am interested in both beta and gamma bands
</i>>>><i> *>* > [15:1:70]. my time frequency looks like this using wavelets,
</i>>>><i> *>* > timefreq =
</i>>>><i> *>* > label: {204x1 cell}
</i>>>><i> *>* > dimord: 'rpt_chan_freq_time'
</i>>>><i> *>* > freq: [1x56 double]
</i>>>><i> *>* > time: [1x1500 double]
</i>>>><i> *>* > powspctrm: [4-D double]
</i>>>><i> *>* > cumtapcnt: [55x56 double]
</i>>>><i> *>* > grad: [1x1 struct]
</i>>>><i> *>* > elec: [1x1 struct]
</i>>>><i> *>* > cfg: [1x1 struct]
</i>>>><i> *>* > trialinfo: [55x1 double]
</i>>>><i> *>* > After regressconfound
</i>>>><i> *>* > hpicomptimefreq =
</i>>>><i> *>* > label: {204x1 cell}
</i>>>><i> *>* > dimord: 'rpt_chan_freq_time'
</i>>>><i> *>* > freq: [1x56 double]
</i>>>><i> *>* > time: [1x1500 double]
</i>>>><i> *>* > powspctrm: [4-D double]
</i>>>><i> *>* > cumtapcnt: [55x56 double]
</i>>>><i> *>* > cfg: [1x1 struct]
</i>>>><i> *>* > trialinfo: [55x1 double]
</i>>>><i> *>* > beta: [4-D double]
</i>>>><i> *>* > Regressconfound took about 1 hr and 30 mins, since its a huge matrix
</i>>>><i> *>* > [55x204x56x1500]. I have 25 such blocks of data for 20 subjects. It
</i>>>><i> *>* > will take an enoumous amount of time to process the data through
</i>>>><i> *>* > regressconfound. Is there a workaround to make the processing faster
</i>>>><i> *>* > or am I missing something. Any help would be of great help.
</i>>>><i> *>* > Thanks,
</i>>>><i> *>* > Raghavan*
</i>>>><i>
</i>>>><i>
</i>>>><i>
</i>>>><i> _______________________________________________
</i>>>><i> fieldtrip mailing list
</i>>>><i> <a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip">fieldtrip at donders.ru.nl</a>
</i>>>><i> <a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a>
</i>>>><i>
</i>>>><i>
</i>>>><i>
</i>>>><i>
</i>>>><i> --
</i>>>><i> Donders Institute for Brain, Cognition and Behaviour
</i>>>><i> Centre for Cognitive Neuroimaging
</i>>>><i> Radboud University Nijmegen
</i>>>><i>
</i>>>><i> Email: <a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip">a.stolk at donders.ru.nl</a>
</i>>>><i> Phone: +31(0)243 68294
</i>>>><i> Web: <a href="http://www.arjenstolk.nl">www.arjenstolk.nl</a>
</i>>>><i>
</i>>>><i> _______________________________________________
</i>>>><i> fieldtrip mailing list
</i>>>><i> <a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip">fieldtrip at donders.ru.nl</a>
</i>>>><i> <a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a>
</i>>>><i>
</i>>><i>
</i>>><i>
</i>>><i> _______________________________________________
</i>>><i> fieldtrip mailing list
</i>>><i> <a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip">fieldtrip at donders.ru.nl</a>
</i>>><i> <a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a>
</i>>><i>
</i>>><i>
</i>>><i>
</i>>><i>
</i>>><i> --
</i>>><i> Donders Institute for Brain, Cognition and Behaviour
</i>>><i> Centre for Cognitive Neuroimaging
</i>>><i> Radboud University Nijmegen
</i>>><i>
</i>>><i> Email: <a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip">a.stolk at donders.ru.nl</a>
</i>>><i> Phone: +31(0)243 68294
</i>>><i> Web: <a href="http://www.arjenstolk.nl">www.arjenstolk.nl</a>
</i>>></pre><div><br></div></div></body></html>