[FieldTrip] Fwd: fieldtrip cluster stats on circular data?
Schoffelen, J.M. (Jan Mathijs)
jan.schoffelen at donders.ru.nl
Tue Dec 1 11:28:53 CET 2020
Dear Tom, dear all,
Let met reply to this e-mail on the discussion list, ’ter lering ende vermaak’ of - hopefully - many.
Begin forwarded message:
From: Tom Marshall <tom.marshall at psy.ox.ac.uk<mailto:tom.marshall at psy.ox.ac.uk>>
Subject: fieldtrip cluster stats on circular data?
Date: 30 November 2020 at 17:50:13 CET
To: "Schoffelen, J.M. (Jan Mathijs)" <jan.schoffelen at donders.ru.nl<mailto:jan.schoffelen at donders.ru.nl>>
Hi JM,
Is there support for using the fieldtrip cluster-stat functions if the axis I want to cluster over is circular?
E.g., say I have spike counts at evenly-spaced phase bins of an oscillation, in two conditions, and I want to test the hypothesis of a difference between the way the spikes phase-cluster in condition A vs condition B. So instead of a time-axis, my data have a phase-axis that spans 0-2pi. It seems like you could use cluster-based permutation to test that hypothesis. In fact you could just hack those data into a fieldtrip structure and plug them into ft_timelockstatistics right away. But ft_timelockstatistics would then not identify clusters if they cross the arbitrary 0/2pi point (because 0 is at the beginning of the vector and 2pi at the end); you would be biased towards finding clusters in certain parts of the phase-space and not others by ignoring its circularity.
Well, the first thing that comes to mind, is that you could - rather than framing this in terms of a ’statfun’ - look into computing spike-field coherence https://www.fieldtriptoolbox.org/tutorial/spikefield/. That is, spike-field coherence (or a similar measure that quantifies the extent to which the timing of point-process are aligned to a preferred phase of an oscillatory process. Then, what you’re after is to statistically compare the spike-field coherence across conditions (provided you control for difference in overall spike rate, and the SNR of the oscillation signal.
Alternatively, and that’s what you asked about, one can think of designing a ’statfun’ that takes the circularity of the independent variable into account. So, in such a context, one would have a bunch of observed (dependent variables) values (e.g. spike rate), which are paired with an independent variable (i.e. the phase of an oscillation at which the spike rate was estimated). What I have done in the past was to operationalize your question into a test-statistic that quantified (least-squares) the amplitude of a cosine function to the data points, as a function of phase. As a matter of fact, following up on a related discussion I recently had in house, I just created a FAQ about this: https://www.fieldtriptoolbox.org/faq/how_can_i_test_whether_a_behavioral_measure_is_phasic/
In this FAQ I pasted the code for a statufn (ft_statfun_cosinefit), which basically estimates the amplitude of the best-fitting cosine wave, determined by the phase values in the design. By default, it does not care about the optimal phase (although the function allows for the constraint to fit a cosine wave with a fixed (specified) phase). One could of course think of other - perhaps more appropriate - test statistics, e.g. the concentration parameter of a von Mises distribution (or the goodness-of-fit of a (mixture of) von Mises distributions, which also would address the question as to whether there’s a single preferred phase to begin with).
The tricky bit would be to think of an appropriate randomization scheme, in order to test a null hypothesis at the first level.
Yet, in your case, it seems you want to do a second level test (i.e. is the amplitude of the cosinefit in condition A systematically larger than in condition B), so the permutation only comes into play when you start permuting across conditions (in which case you can just use a depsamplesT based test statistic.
Best wishes,
JM
So question part A: Has anyone implemented this before and if so is there code for it?
Yes, and yes. See above.
Part B: <wild guesses welcome> Do you think adapting the cluster-stats code would be a big/difficult job for a moderately-experienced coder who knows the fieldtrip source a bit (i.e., me)? Which low-level functions are the right place to start looking? And would this be useful for the fieldtrip user base? If so I’d happily try to implement it and submit a PR.
Thanks. Let’s follow this up if you were thinking of another solution as the one outlined above.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20201201/db2eb39e/attachment.htm>
More information about the fieldtrip
mailing list