Skip to content

FIX: whitening issue when combining runs #1902

Closed

Description

@dengemann

Apparently there is an issue with whitening and cov computation if multiple SSSed runs are considered in which the numbe of components dffer. Let's say over 10 runs we have a component range of 67-71 and then compute the covariance on epochs that include data from all these runs. The covariance spectrum would indicate a rank of 91, irrespective of the method used (e.g. empirical), but clearly the resulting whitening would look inappropriate. Contrastingly, when computed runwise, the rank of the cov would reflect the number of SSS components in that run.

Any intuition? @Eric89GXL @agramfort @mshamalainen @LauriParkkonen

Activity

  1. larsoner commented on Mar 24, 2015

    @larsoner
    Member

    I take it the runs were not translated into the same head position?

  2. agramfort commented on Mar 24, 2015

    @agramfort
    SponsorMember
  3. dgwakeman commented on Mar 24, 2015

    @dgwakeman
    Contributor

    I assume the noise is so bad that SSS is necessary (personally, I avoid it and try to stick with SSPs as much as possible).

  4. kingjr commented on Mar 24, 2015

    @kingjr
    Member

    @Eric89GXL @agramfort @dengemann
    This seems plausible indeed: I get an issue as soon as I concatenate two runs, even if I estimate the covariance on the trials of the first run (although estimating the covariance on the first run alone is ok). I'll check it out. Thanks!

  5. kingjr commented on Mar 24, 2015

    @kingjr
    Member

    Yep, head positions were not translated to a common head position... I just need to find a maxfilter licence now...

    Thanks again!

  6. changed the title [-]FIX: whitening / rank issue when combining [/-] [+]FIX: whitening issue when combining [/+] on Apr 16, 2015
  7. changed the title [-]FIX: whitening issue when combining [/-] [+]FIX: whitening issue when combining runs[/+] on Apr 16, 2015
  8. dengemann commented on Apr 16, 2015

    @dengemann
    MemberAuthor

    We re-analyzed the data after having used the SSS realignement. The issue remains though. Interestingly the whitening looks correct if the cov and the evoked are computed on 10% of the trials across all runs. So combining across runs does not seem to be the issue anymore but using all trials (~1900). Any thoughts, ideas, anyone?

    @agramfort @Eric89GXL

  9. larsoner commented on Apr 16, 2015

    @larsoner
    Member

    Try calculating it on 10% of the trials (190), versus 10 copies of those 10% of trials (total 1900). It's possible this is a numerical precision issue that starts appearing with accumulation or something.

  10. kingjr commented on Apr 16, 2015

    @kingjr
    Member

    @Eric89GXL Copying 10 times 10% of the trials looks fine (i.e. it's similar case to the evoked=epochs[::10].average scenario)

  11. larsoner commented on Apr 16, 2015

    @larsoner
    Member

    So that makes it less likely to be an accumulation error... weird.

    The eigenvalue plots and covariance plots for the two links above look pixel-for-pixel identical to me, I think there was a plotting error.

  12. dengemann commented on Apr 16, 2015

    @dengemann
    MemberAuthor

    The eigenvalue plots and covariance plots for the two links above look pixel-for-pixel identical to me, I think there was a plotting error.

    @Eric89GXL this is because it's the same covariance in both cases. The cov seems fine, something is to be understood about the averaging / whitening.

  13. larsoner commented on Apr 16, 2015

    @larsoner
    Member

    I'm confused -- I thought that the whitening matrix was entirely determined by the covariance matrix (assuming the selection of channels is identical). If that's true, it implies something about your average actually being different.

  14. dengemann commented on Apr 16, 2015

    @dengemann
    MemberAuthor

    @Eric89GXL what we have is:

    • covariance computed on all trials
    • applied to 10% of the data --> 'correct'
    • applied to all data --> 'inappropriate'

    something is really weird here.

  15. 14 remaining items

  16. kingjr commented on Apr 17, 2015

    @kingjr
    Member

    I think @Eric89GXL is right. The data I was playing with were bandpass filtered a .75 - 35 Hz.

    I retried with just a lowpass at 35Hz + baseline on the first 200 ms after epoch onset (stim comes 430 ms after epoch onset), and it gets a little better on the 1900 epochs average:

    index

    https://dl.dropboxusercontent.com/u/3518236/report_Filter_0_35Hz.html

    It's still not perfect though...

  17. dengemann commented on Apr 17, 2015

    @dengemann
    MemberAuthor

    the problem with this baselining is that it induces these late, probably
    spurious, components. Not sure this looks so much better. I think the
    butterfy plot used to look better before. With 1900 we might have to live
    with the fact that we find non-Gaussian processes in the baseline that
    cannot be whitened away. To be discussed.

    2015-04-17 9:43 GMT+02:00 J-R King [email protected]:

    I think @Eric89GXL https://github.com/Eric89GXL is right. The data I
    was playing with were bandpass filtered a .75 - 35 Hz.

    I retried with just a lowpass at 35Hz + baseline on the first 200 ms after
    epoch onset (stim comes 430 ms after epoch onset), and it gets a little
    better on the 1900 epochs average:

    [image: index]
    https://cloud.githubusercontent.com/assets/4881164/7197807/a47a54c2-e4e5-11e4-99f6-e5476372a6c8.png

    https://dl.dropboxusercontent.com/u/3518236/report_Filter_0_35Hz.html

    It's still not perfect though...

    —
    Reply to this email directly or view it on GitHub
    #1902 (comment)
    .

  18. agramfort commented on Apr 20, 2015

    @agramfort
    SponsorMember
  19. dengemann commented on Apr 20, 2015

    @dengemann
    MemberAuthor

    I think we're having a "funny" dataset, with ~2000 trials SNR is so high
    that extremelt weak phase sustained time-locked become visible. Not 100%
    sure this is really the case though, but currently the best supported
    interpretation given the evidence.

    2015-04-20 13:50 GMT+02:00 Alexandre Gramfort [email protected]:

    what's going on here?

    —
    Reply to this email directly or view it on GitHub
    #1902 (comment)
    .

  20. larsoner commented on Dec 20, 2016

    @larsoner
    Member

    Coming back to the original point about combining SSS runs, a similar problem happens with maxwell_filter when doing movement compensation with regularization. There are two problems actually:

    1. There are some edge artifacts at head-position boundaries.

    2. The number of components varies as a function of time.

    Point (1) is usually minor, but there are ways to fix it and I plan to do so soon.

    Point (2) is harder but seems to be fixed quite nicely by mne.cov.regularize. Things like "shrunk" and "factor_analysis" are not as robust to such data with a time-varying number of components AFAICT.

    I am tempted to recommend that poeple use mne.cov.regularize when dealing with data that have been processed with MNE-Python's movement compensation algorithm. Thoughts @agramfort @dengemann ?

  21. self-assigned this
    on Dec 20, 2016
  22. agramfort commented on Dec 21, 2016

    @agramfort
    SponsorMember
  23. dengemann commented on Dec 21, 2016

    @dengemann
    MemberAuthor

    am tempted to recommend that poeple use mne.cov.regularize when dealing with data that have been processed with MNE-Python's movement compensation algorithm.

    Ok time for action. We should not regress back to mne.cov.regularize. I'm optimistic that we can elaborate a solution to this problem.

    can you tell us more? what do you get when using auto mode? what values do
    you use with mne.cov.regularize?

    yes please!

  24. larsoner commented on Dec 21, 2016

    @larsoner
    Member

    what do you get when using auto mode?

    For data with time-varying rank or spatial structure, the ECD localization bias is about the same as when using an empirical noise covariance, which is 2+ cm localization bias on phantom data that is ~1mm bias with regularized cov. I think it's due to small non-zero eigenvalues. In other words, I think the automated methods are producing a "correct" result, in the sense that it is rightfully producing some small non-zero eigenvalues corresponding to the chunks of data that are only present part of the time. However those small eigenvalues effectively break the whitening step. I suspect those methods are meant to be used for data with spatially stationary noise processes or at least data with constant rank, and movement-compensated data with time-varying regularization (or other data with similar time-varying structure) will likely not work.

    I can try to simulate some simple data to show this effect.

    what values do you use with mne.cov.regularize?

    The defaults. It probably doesn't matter much so long as the eigenvalues are prevented from getting too small during whitening.

  25. dengemann commented on Dec 21, 2016

    @dengemann
    MemberAuthor
  26. larsoner commented on Dec 21, 2016

    @larsoner
    Member

    @dengemann you originally reported the same problem over a year and a half ago... surely you've seen this problem, too?

  27. dengemann commented on Dec 21, 2016

    @dengemann
    MemberAuthor
  28. kingjr commented on Dec 21, 2016

    @kingjr
    Member

    (FWIW & from what I remember, shrunk covariance solved the problem in most subjects. However the issue was originally due to distinct dev_head_t + high number of trials.)

  29. larsoner commented on Apr 4, 2018

    @larsoner
    Member

    Moved to #3985, closing here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions