Describe the new feature or enhancement
@jundurraga and I would like to add two different statistical tests which are used to determine the presence of steady-state evoked potentials. An F-test (Dobie 1996) and a two-sample Hotelling T2 (Hofmann 2012).
Recently in #8867 an example of analysis of visual steady state responses was added. But this is a largely qualitative analysis, we wish to add quantitative statistical measures which are widely used in the analysis of auditory steady state responses (ASSRs). These responses are useful for objectively evaluating auditory thresholds, assessing suprathreshold hearing, and monitoring the state of arousal during anesthesia (Picton 2003).
Describe your proposed implementation
In ASSRs, sounds are presented which are modulated at a known rate (e.g. 40 Hz). When analysing the M/EEG signal we wish to determine if the measured signal contains a consistent component at the frequency of interest, or if the signal at the frequency of interest is random. This is typically done using an F-test which looks at the power in the FFT bin of interest (signal) relative to a sample of neighbouring FFT bins (noise). So in the example above, you compare the power in the FFT bin corresponding to 40 Hz with, for example, the 30 bins above and below this bin (this may correspond to +- 1.5Hz, depends on the length of epochs and sample rate). Whereas in the HT2 test the noise estimate is based on the variation within the single FFT bin of interest across epochs (rather than the adjacent bins) and looks at both the consistency of both the real and imaginary component of the FFT. These tests have been widely validated and in our tutorial we can demonstrate that they give appropriate false positive rates.
Does this seem appropriate for adding to MNE? We will also create a new tutorial as the new tagging example is more about comparing two different conditions, whereas ASSRs are usually measured in continuous ~5 min blocks. We can easily contribute a small example data file too.
Describe possible alternatives
Jaime already has open source python code for these tests. I cant link to them now because gitlab is down. But we can do when its back up.
API: Function names
I was thinking to put the code in mne/stats/steadystateresponses.py
I have looked at the parametric stats section and the names f_... are already used. So to differentiate from these existing stats methods I was thinking something like
ssr_f_test: Steady-state response f-test.
ssr_ht2_test: Steady-state response two-sample hotelling T2 test.
Or would it be better to be more explicit with something like steadystateresponse_f_test().
API: Function returns
This function will return lots of information including signal amplitude, signal phase, noise amplitude, noise phase, test statistic, p value, etc.
In my personal code I return a data frame. As its common to analyse many different frequencies you can easily then append the output of many functions. However, pandas is an optional dependency for MNE. Are there other statistical functions in MNE that return quite a bit of information and how do they do it? A dict? Then its easy to convert to a dataframe and loop.
Additional comments
Jaime have I missed anything?
If this work seems appropriate for MNE then we can open a pull request. The code here should be relatively easy as we both have several implementations of these tests already, I think the tricky part will be deciding a nice API that fits with existing MNE infrastructure.
Describe the new feature or enhancement
@jundurraga and I would like to add two different statistical tests which are used to determine the presence of steady-state evoked potentials. An F-test (Dobie 1996) and a two-sample Hotelling T2 (Hofmann 2012).
Recently in #8867 an example of analysis of visual steady state responses was added. But this is a largely qualitative analysis, we wish to add quantitative statistical measures which are widely used in the analysis of auditory steady state responses (ASSRs). These responses are useful for objectively evaluating auditory thresholds, assessing suprathreshold hearing, and monitoring the state of arousal during anesthesia (Picton 2003).
Describe your proposed implementation
In ASSRs, sounds are presented which are modulated at a known rate (e.g. 40 Hz). When analysing the M/EEG signal we wish to determine if the measured signal contains a consistent component at the frequency of interest, or if the signal at the frequency of interest is random. This is typically done using an F-test which looks at the power in the FFT bin of interest (signal) relative to a sample of neighbouring FFT bins (noise). So in the example above, you compare the power in the FFT bin corresponding to 40 Hz with, for example, the 30 bins above and below this bin (this may correspond to +- 1.5Hz, depends on the length of epochs and sample rate). Whereas in the HT2 test the noise estimate is based on the variation within the single FFT bin of interest across epochs (rather than the adjacent bins) and looks at both the consistency of both the real and imaginary component of the FFT. These tests have been widely validated and in our tutorial we can demonstrate that they give appropriate false positive rates.
Does this seem appropriate for adding to MNE? We will also create a new tutorial as the new tagging example is more about comparing two different conditions, whereas ASSRs are usually measured in continuous ~5 min blocks. We can easily contribute a small example data file too.
Describe possible alternatives
Jaime already has open source python code for these tests. I cant link to them now because gitlab is down. But we can do when its back up.
API: Function names
I was thinking to put the code in
mne/stats/steadystateresponses.pyI have looked at the parametric stats section and the names
f_...are already used. So to differentiate from these existing stats methods I was thinking something likessr_f_test: Steady-state response f-test.ssr_ht2_test: Steady-state response two-sample hotelling T2 test.Or would it be better to be more explicit with something like
steadystateresponse_f_test().API: Function returns
This function will return lots of information including signal amplitude, signal phase, noise amplitude, noise phase, test statistic, p value, etc.
In my personal code I return a data frame. As its common to analyse many different frequencies you can easily then append the output of many functions. However, pandas is an optional dependency for MNE. Are there other statistical functions in MNE that return quite a bit of information and how do they do it? A dict? Then its easy to convert to a dataframe and loop.
Additional comments
Jaime have I missed anything?
If this work seems appropriate for MNE then we can open a pull request. The code here should be relatively easy as we both have several implementations of these tests already, I think the tricky part will be deciding a nice API that fits with existing MNE infrastructure.