[FieldTrip] Problems with statistics for circular data

Andre Cravo andrecravo at gmail.com
Thu Jan 16 13:04:30 CET 2014


Dear Thomas,

Please find attached two scripts with parametric paired t-tests for
circular data. The first is for first order data, so the input are two
vectors with the data.

The second one is for second order data, so you need four vectors as
inputs: two with the phase values and two with the respective mean
resultant length for each phase value. This is important since in
second order data(as when you are comparing data from different
participants) you should give higher weights to values that are more
concentrated around their mean phase.

I wrote the scripts to myself, so they are not as commented as they
should be, but I hope they are straight forward enough. Please write
me if you have any doubts or find any mistakes.

Best

-- 
Andre M. Cravo
Center for Mathematics, Computation and Cognition
Federal University of ABC., Brazil
http://neuro.ufabc.edu.br/timing

On 16 January 2014 04:52,  <Thomas.Baumgarten at med.uni-duesseldorf.de> wrote:
> Dear Pierre,
>
>
>
> Thank you very much for your quick reply. I downloaded the scripts for the
> two non-parametrical tests and will give it a try. Again, thanks for the
> help!
>
>
>
> Best regards,
>
> Thomas
>
>
>
> Von: fieldtrip-bounces at science.ru.nl
> [mailto:fieldtrip-bounces at science.ru.nl] Im Auftrag von Pierre Mégevand
> Gesendet: Mittwoch, 15. Januar 2014 15:48
> An: fieldtrip at science.ru.nl
>
>
> Betreff: Re: [FieldTrip] Problems with statistics for circular data
>
>
>
> Dear Thomas,
>
>
>
> When the assumptions of the parametric Watson-Williams test aren't met, you
> can use non-parametric statistical tests for circular data, such as Watson's
> Yr or U2 tests.
>
>
>
> The Yr test is implemented in the MATLAB toolbox PhasePACK by Daniel
> Rizzuto: cmean_test.m function,
> https://github.com/iandol/spikes/tree/master/Various/PhasePACK).
>
>
>
> You can find matlab code for the U2 test here:
> http://www.mathworks.com/matlabcentral/fileexchange/43543-watsons-u2-statistic-based-permutation-test-for-circular-data.
> I programmed this; it runs very slowly, so if anyone is interested in
> looking into it I'm sure we could make it much better.
>
>
>
> Pierre
>
> --
>
> Pierre Mégevand, MD, PhD
>
> Post-doctoral research fellow
>
> Laboratory for Multimodal Human Brain Mapping
>
> Feinstein Institute for Medical Research
>
> Manhasset, NY, USA
>
>
>
> On Wed, Jan 15, 2014 at 5:20 AM, <fieldtrip-request at science.ru.nl> wrote:
>
> Send fieldtrip mailing list submissions to
>         fieldtrip at science.ru.nl
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> or, via email, send a message with subject or body 'help' to
>         fieldtrip-request at science.ru.nl
>
> You can reach the person managing the list at
>         fieldtrip-owner at science.ru.nl
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of fieldtrip digest..."
>
>
> Today's Topics:
>
>    1. Re: Problems with statistics for circular data (Tobias Staudigl)
>    2. Re: ft_sourcestatistics and sourcegrandaverage    time    series
>       (jan-mathijs schoffelen)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Wed, 15 Jan 2014 10:19:04 +0100
> From: Tobias Staudigl <tobias.staudigl at uni-konstanz.de>
> To: FieldTrip discussion list <fieldtrip at science.ru.nl>
> Subject: Re: [FieldTrip] Problems with statistics for circular data
> Message-ID: <52D65288.3070207 at uni-konstanz.de>
> Content-Type: text/plain; charset="iso-8859-1"; Format="flowed"
>
>
>
> Dear Thomas,
>
> try using circ_dist.m (in the circ_stats toolbox by Berens).
> This should solve the circular difference issue.
>
> all the best,
> Tobias
>
> Am 15.01.2014 09:35, schrieb Thomas.Baumgarten at med.uni-duesseldorf.de:
>>
>> Dear FieldTrip users,
>>
>> I am working on a set of circular data (phase angles of ongoing
>> oscillations computed via Hilbert transform) and would like to
>> statistically compare two conditions (A,B). For this, I use the
>> circular statistics toolbox for matlab by P. Berens. I worked on this
>> problem from two different angles:
>>
>> 1. First, I tried to directly compare the two conditions via the
>> Watson-Williams two-sample test (function: circ_wwtest).
>> Unfortunately, this didn't work out, since the test requires an
>> average resultant vector length of > 0.45 for n >= 11 entries/
>> subjects, an assumption which is not met by my data.
>>
>> 2. Second, I tried to calculate the angle of difference between the
>> two conditions (angle(A) -- angle(B)) and then used  the one-sample
>
>> mean angle test (function: circ_mtest) to test if the resulting angle
>> of difference is significantly different from zero. Here, the
>> following problems arise: Since the resulting angles for A and B range
>> from --pi to +pi, there are cases when the subtraction of the two
>> angles results in roughly +2pi or -2pi (e.g. cases where (A = pi) --
>
>> (B = -pi) = 2pi), resulting in an error from the circ_mtest function.
>> I tried to solve this problem by using a modulus (2pi) operation (i.e.
>> by 'cleaning out' the redundant circumventions while at the same time
>> preserving the angle information), but unfortunately this didn't work
>> out either.
>>
>> The only other option I can think of would be to generate surrogate
>> data (i.e. a matrix with the same dimensions as the matrix with the
>> angles of difference , only filled with zeros) and to apply a
>> cluster-based permutation test (similar to ft_freqstatitics). Although
>> this would take care of my multiple-comparison problem, I am not quite
>> sure if the cluster correction is still valid in this case and if this
>> test would work for circular data.
>>
>> I would greatly appreciate any comments and advice on this matter.
>>
>> Thanks for your help,
>>
>> Thomas
>>
>> Thomas Baumgarten, PhD Student
>>
>> Institute of Clinical Neuroscience and Medical Psychology, Medical
>> Faculty, Heinrich-Heine-University D?sseldorf, Universit?tsstra?e 1,
>> 40225 D?sseldorf, Germany
>
>>
>>
>>
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
>
> --
> Dr. Tobias Staudigl
> Fachbereich Psychologie - ZPR
> Postfach ZPR
> 78457 Konstanz
> ZPR, Haus 12
> Tel.: +49 (0)7531 / 88 - 5703
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20140115/c71480a1/attachment-0001.html>
>
> ------------------------------
>
> Message: 2
> Date: Wed, 15 Jan 2014 11:18:53 +0100
> From: jan-mathijs schoffelen <jan.schoffelen at donders.ru.nl>
> To: FieldTrip discussion list <fieldtrip at science.ru.nl>
> Subject: Re: [FieldTrip] ft_sourcestatistics and sourcegrandaverage
>         time    series
> Message-ID: <14425A96-E395-4757-904B-5AFB8FEED3EB at donders.ru.nl>
> Content-Type: text/plain; charset="us-ascii"
>
> Hi Kaelasha,
>
> Sorry for being unclear. You can do something like:
>
> stat = ft_sourcestatistics(cfg, data1, data2, data3, data4, ....), or stat =
> ft_sourcestatistics(cfg, data{:}); where data is a cell-array of structures
> (1 cell for each participant/condition).
>
> Best,
> Jan-Mathijs
>
>
>
>
> On Jan 15, 2014, at 9:14 AM, Kaelasha Tyler wrote:
>
>> Hi Jan-Mathijs,
>>
>> Thanks for this response.
>> I still have a question though.
>> You mentioned that it is not necessary to use ft_sourcegrandaverage to
>> perform statistical analysis with source space ERFs across multiple
>> participants. However, what you appeared to suggest in your email, does
>> appear to still use a grand average, e.g. you wrote:
>>
>> >you can do something like this
>>
>> >cfg = your cfg to ft_sourcestatistics
>> >stat = ft_sourcestatistics(cfg, grandavg{:});
>>
>> Having played around with it a bit more, I am still unclear how to use
>> multiple inputs (e.g., multiple subjects source data) when using
>> ft_sourcestatistics. I had thought that ft_sourcegrandavarge was a
>> necessity.
>> Can you make this a bit clearer?
>>
>> Also, I did go back and use cfg.fixedori='yes' when calling my first
>> ft_srouceanalysis and moved also my source.avg.mom data into source.avg.pow
>> as you suggested, but this still leaves me with the question above- how to
>> use multiple subjects source data in ft_sourcestatistics?
>>
>> Once again, any help from anyone would be much appreciated!
>>
>> Kaelasha
>>
>> From: fieldtrip-bounces at science.ru.nl [fieldtrip-bounces at science.ru.nl] on
>> behalf of jan-mathijs schoffelen [jan.schoffelen at donders.ru.nl]
>> Sent: Tuesday, 14 January 2014 5:52 PM
>> To: FieldTrip discussion list
>> Subject: Re: [FieldTrip] ft_sourcestatistics and sourcegrandaverage time
>> series
>>
>> Hi Kaelasha,
>>
>> You actually don't need to use ft_sourcegrandaverage if your goal is to do
>> statistics. Ft_sourcestatistics in principle knows how to deal with multiple
>> inputs.
>> Thus,
>> rather than doing
>>
>> cfg = [];
>> cfg.keepindividual = 'yes';
>> grandavg = ft_sourcegrandaverage(cfg, subjectdata{:});
>>
>> you can do something like this
>>
>> cfg = your cfg to ft_sourcestatistics
>> stat = ft_sourcestatistics(cfg, grandavg{:});
>>
>> Now, the question boils down to 'how to fool ft_sourcestatistics to
>> swallow my data?'.
>>
>> The following should more or less work (but requires some manual labour):
>>
>> The time courses at the voxel level are present in source.avg.mom. These
>> are most likely 3xN, 3 dipole orientations times N time points. In order to
>> reduce this, one can project the orientation along the first pca-axis. This
>> can be achieved by a call to ft_sourcedescriptives with
>> cfg.projectmom='yes', or by calling ft_sourceanalysis in the first place
>> with cfg.fixedori = 'yes'.
>> Then, you could do something like:
>>
>> pow = zeros(size(source.pos,1),length(source.time);
>> pow(source.inside,:) = cat(1,source.avg.mom{source.inside});
>> source.avg.pow = pow;
>>
>> Just to be sure, add a time-axis to the source structure, i.e. source.time
>> = tlck.time (tlck being the data structure used to create the lcmv-output).
>>
>> I think this should bring you close to doing statistics.
>>
>> Best,
>> Jan-Mathijs
>>
>>
>>
>> On Jan 14, 2014, at 7:19 AM, Kaelasha Tyler wrote:
>>
>>> Hi all,
>>>
>>> Reading through the discussion list, I see others have also had some
>>> issues with creating grand averaged source space time series (ERFs) and
>>> subsequent statistical analysis,  but I can't see any solutions....
>>>
>>> Questions:
>>> How can I create time series (ERFs) for grand averaged source space data?
>>> And, how can I do cluster analysis on these (yet to be created) grand
>>> averaged source  space ERFs?
>>>
>>>
>>> I have used ft_SOURCEANALYSIS with method 'lcmv' for individual
>>> participants to generate source space time series, in data.avg.mom.
>>>
>>> Subsequently I used ft_sourcegrandaverage to combine source space data
>>> across subjects.
>>>
>>> However my grand averaged source data.avg only contains 'pow' and no
>>> 'mom'. Eg, no time series for the grand averaged source space data.
>>>
>>> As such, I can not do cluster analysis on grand averaged ERFs in source
>>> space.
>>>
>>> It appears that ft_sourcestatistics only works with parameters that have
>>> not more than one value per grid point (e.g. pow, nai etc) and is unable to
>>> work with ERF time series? Is this true?
>>>
>>> Can any one help with this?
>>>
>>> Much obliged.
>>> Kaelasha
>
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> fieldtrip mailing list
>>> fieldtrip at donders.ru.nl
>>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>
>> Jan-Mathijs Schoffelen, MD PhD
>>
>> Donders Institute for Brain, Cognition and Behaviour,
>> Centre for Cognitive Neuroimaging,
>> Radboud University Nijmegen, The Netherlands
>>
>> Max Planck Institute for Psycholinguistics,
>> Nijmegen, The Netherlands
>>
>> J.Schoffelen at donders.ru.nl
>> Telephone: +31-24-3614793
>>
>> http://www.hettaligebrein.nl
>
>>
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
> Jan-Mathijs Schoffelen, MD PhD
>
> Donders Institute for Brain, Cognition and Behaviour,
> Centre for Cognitive Neuroimaging,
> Radboud University Nijmegen, The Netherlands
>
> Max Planck Institute for Psycholinguistics,
> Nijmegen, The Netherlands
>
> J.Schoffelen at donders.ru.nl
> Telephone: +31-24-3614793
>
> http://www.hettaligebrein.nl
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20140115/a1878500/attachment.html>
>
> ------------------------------
>
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
> End of fieldtrip Digest, Vol 38, Issue 18
> *****************************************
>
>
>
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
-------------- next part --------------
A non-text attachment was scrubbed...
Name: circ_ttest_p_first.m
Type: text/x-objcsrc
Size: 1167 bytes
Desc: not available
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20140116/e53e865a/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: circ_ttest_p_second.m
Type: text/x-objcsrc
Size: 1188 bytes
Desc: not available
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20140116/e53e865a/attachment-0001.bin>


More information about the fieldtrip mailing list