[FieldTrip] Sign flip in lcmv spatial filter with different versions of MATLAB

Schoffelen, J.M. (Jan Mathijs) janmathijs.schoffelen at donders.ru.nl
Sat Sep 4 12:16:36 CEST 2021


Dear Bushra,

I would assume - since you were not specific about this in your e-mails - that you used a cfg.(method).fixedori = ‘yes’ constraint, resulting in a scalar spatial filter (i.e. 1 coefficient per channel, rather than 3 coefficients per channel). The sign flip that you observed is the consequence of the matlab-version specific numeric behavior of the underlying singular value decomposition (svd) that is used to rotate the local dipole’s coordinate system, in order for their axes to point along the orientations of most variance explained. In an svd (or eigenvalue decomposition) the orientation of the singular vectors (or eigenvectors) is ambiguous with respect to their sign, and there is not much that can be done about it. As such, none of the outputs is ‘less correct’ than the other one.
Depending on what you want to do in your downstream analysis, the polarity issue is something to keep in mind (and account for). Note that this not only counts for a comparison of the same dipole’s reconstructed activity on two subsequent computations (with 2 different matlab versions, or on two different operating systems etc) but also when you compare the dipole’s activity with its neighbour. Usually, people look at the absolute (or squared) values of the dipoles’ activity (i.e. taking abs(filter * data) ), so in that case the polarity of the signal does not matter.

Best wishes,
Jan-Mathijs


On 3 Sep 2021, at 13:51, Bushra Riaz Syeda via fieldtrip <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>> wrote:

Hello,

Just to update, I have checked more subjects and I found that the sign flip is in a lot of subjects ( but my labels were only affected in 3 subjects).
Wouldnt this make results unreliable? as reproducibility of results is affected.

Kind regards
Bushra Riaz



________________________________
From: fieldtrip <fieldtrip-bounces at science.ru.nl<mailto:fieldtrip-bounces at science.ru.nl>> on behalf of Bushra Riaz Syeda via fieldtrip <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>>
Sent: 01 September 2021 13:25
To: FieldTrip discussion list <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>>
Cc: Bushra Riaz Syeda <bushra.riaz at gu.se<mailto:bushra.riaz at gu.se>>
Subject: [FieldTrip] Sign flip in lcmv spatial filter with different versions of MATLAB

Hello,



I am having a strange error. I calculated lcmv beamformer for my  Neuromag dataset couple of years ago. I ran some beamformer based analysis and now I thought I will redo some part of the analysis.
I noticed during the rerun of my scripts that the spatial filter calculated for 3 subjects ( out of 20) has a sign flip for 3-5 % of the vertices. After investigating for a week, I found that I get sign flip for these vertices when I run the same script with MATLAB 2013b and MATLAB 2017a ( fieldtrip version was same for both runs).



I have attached the figure for one of the vertex of spatial filter with both MATLAB versions.



Now my question is, as this sign flip is affecting my further analysis, I would like to know , how to figure out which one is correct and if anyone has any idea where the error could be coming from.
Thank you
Any help would be highly appreciated.



Kind regards
Bushra Riaz

_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!opPvVMAA85HcdDVfVezgEXp69oQL4SkYmYgdgvy0mdyHTTDecifPewqlEgudYoubyWgQCKPZ6n_MBJM$

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20210904/887d6917/attachment.htm>


More information about the fieldtrip mailing list