# MNE source estimate analysis with multiple conditions

**URL:** <https://mne.discourse.group/t/mne-source-estimate-analysis-with-multiple-conditions/1202>\
**Category:** Mailing List Archive (read-only)\
**Tags:** list-archive\
**Created:** [April 6, 2017, 3:42pm UTC](https://mne.discourse.group/t/mne-source-estimate-analysis-with-multiple-conditions/1202 "2017-04-06T15:42:49Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [April 6, 2017, 3:42pm UTC](https://mne.discourse.group/t/mne-source-estimate-analysis-with-multiple-conditions/1202/1 "2017-04-06T15:42:49Z")

</div>

Dear MNE users,

I am analysing surface-based source estimates computed from evoked MEG data. I would like to extract peak amplitude times from source estimates of the difference between two experimental conditions (exp. and control), and as far as I can tell there are two approaches to this. One is to calculate the difference prior to computing source estimates (i.e: exp. evoked - control evoked) and then compute source estimates (.stc) based on the returned array. Another is to generate source estimates for each condition, and then subtract the returned stc files (exp.stc - control.stc) Unfortunately, these two approaches yield slightly different results (I suspect this is due to noise generated by the .stc subtraction) - so which would be most prudent? Alternatively, is there a different (more robust) approach that I could use?

Thanks in advance for any help!

Regards,

Lyam

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [April 7, 2017, 11:43am UTC](https://mne.discourse.group/t/mne-source-estimate-analysis-with-multiple-conditions/1202/2 "2017-04-07T11:43:03Z")

</div>

Dear Lyam,

the reason why you see a difference between MNE(cond1) - MNE(cond2) and  
MNE(cond1 - cond2) is because of the dipole orientations. The source  
estimate only retains the magnitude of the dipoles. See here for some  
more information about what is going on:

[https://4006-1301584-gh.circle-artifacts.com/0/home/ubuntu/mne-python/doc/\_build/html/auto\_tutorials/plot\_dipole\_orientations.html](https://4006-1301584-gh.circle-artifacts.com/0/home/ubuntu/mne-python/doc/_build/html/auto_tutorials/plot_dipole_orientations.html)

When using fixed orientations, there should not be any difference. When  
using loose orientations (the default), MNE(cond1 - cond2) is in my  
opinion the correct way.

regards,  
Marijn.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [April 8, 2017, 4:08pm UTC](https://mne.discourse.group/t/mne-source-estimate-analysis-with-multiple-conditions/1202/3 "2017-04-08T16:08:54Z")

</div>

Hi Lyam

I think it's great that you are making so much progress on your own! That  
said, I'd like to chat with you before you put too much more time into this  
project, just so we're on the same page. I (re)gained some insights into  
beamforming in the final days before the conference and I'd like to chat  
about all that. Maybe we could chat right after N&B on Monday?

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [April 11, 2017, 12:49am UTC](https://mne.discourse.group/t/mne-source-estimate-analysis-with-multiple-conditions/1202/4 "2017-04-11T00:49:53Z")

</div>

Dear Marijin,

Thanks for your help! I think I see what you're saying, but just to clarify, does MNE(cond1-cond2) refer to source estimates generated from (evoked cond1 - evoked cond2)?

Regards

Lyam

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [April 11, 2017, 5:06pm UTC](https://mne.discourse.group/t/mne-source-estimate-analysis-with-multiple-conditions/1202/5 "2017-04-11T17:06:06Z")

</div>

Hi Liam,

yes, exactly!

Marijn.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [April 11, 2017, 5:18pm UTC](https://mne.discourse.group/t/mne-source-estimate-analysis-with-multiple-conditions/1202/6 "2017-04-11T17:18:59Z")

</div>

But this way you will have a hard time interpreting your effect. Using dSPM  
on each condition and then forming a contrast is also legitimate, as long  
as you have a meaningful baseline. This would be dSPM(a) - dSPM(b).

Denis

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [April 11, 2017, 5:31pm UTC](https://mne.discourse.group/t/mne-source-estimate-analysis-with-multiple-conditions/1202/7 "2017-04-11T17:31:55Z")

</div>

> This would be dSPM(a) - dSPM(b).

tiny detail: this will only be true if the two conditions have the  
same number of epochs averaged in each condition.

Alex

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [April 17, 2017, 3:30pm UTC](https://mne.discourse.group/t/mne-source-estimate-analysis-with-multiple-conditions/1202/8 "2017-04-17T15:30:19Z")

</div>

Hi Alex,

Thanks for the tip! I'm glad you mentioned this because as it happens, I don't have the same number of epochs for each condition. Can you suggest a work around?

Regards

Lyam

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [April 17, 2017, 3:40pm UTC](https://mne.discourse.group/t/mne-source-estimate-analysis-with-multiple-conditions/1202/9 "2017-04-17T15:40:11Z")

</div>

Does your experimental logic allow you to equalize the number of epochs per  
conditions or do you have some rare events by design?

Denis

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [April 17, 2017, 4:04pm UTC](https://mne.discourse.group/t/mne-source-estimate-analysis-with-multiple-conditions/1202/10 "2017-04-17T16:04:54Z")

</div>

I suppose we could equalise the number of epochs per condition, in theory (although I'm not familiar with the best way to do this). Basically the unequal epoch numbers arose due to problems during data collection, whereby a few random trials were lost in almost every subject.

Regards

Lyam

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [April 17, 2017, 7:08pm UTC](https://mne.discourse.group/t/mne-source-estimate-analysis-with-multiple-conditions/1202/11 "2017-04-17T19:08:15Z")

</div>

Hi Lyam,

See here:

[http://martinos.org/mne/dev/generated/mne.epochs.equalize\_epoch\_counts.html](http://martinos.org/mne/dev/generated/mne.epochs.equalize_epoch_counts.html)

HTH,

Andy

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [April 18, 2017, 2:55pm UTC](https://mne.discourse.group/t/mne-source-estimate-analysis-with-multiple-conditions/1202/12 "2017-04-18T14:55:44Z")

</div>

Thanks Andy!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [May 30, 2017, 4:54pm UTC](https://mne.discourse.group/t/mne-source-estimate-analysis-with-multiple-conditions/1202/13 "2017-05-30T16:54:12Z")

</div>

Hi everyone,

I have a followup question regarding the group level contrast: Do I need to  
apply mne.label\_sign\_flip before averaging the activaitons across all  
subjects?

I used "fixed=False, loose=0.2" to get the inverse solution, then I defined  
"pick\_ori="normal"" when applying the inverse solution to the evoked  
difference (evoked1 - evoked2) for each subject.

I'm wondering if I should flip the signs when averaging the activations  
across subjects.

Thanks for the help!

Lin

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [May 31, 2017, 6:13am UTC](https://mne.discourse.group/t/mne-source-estimate-analysis-with-multiple-conditions/1202/14 "2017-05-31T06:13:17Z")

</div>

hi Lin,

the label\_sign\_flip is used to average time courses within a label  
in order to avoid signal cancellations.

Alex

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [May 31, 2017, 12:36pm UTC](https://mne.discourse.group/t/mne-source-estimate-analysis-with-multiple-conditions/1202/15 "2017-05-31T12:36:38Z")

</div>

Hi Alex,

Thanks for the clarification.

As far as I understand, the sign flip can be used to avoid signal  
cancellation when averaging signed values. This cancellation could come  
from averaging within ROIs or across trials/subjects.  
In the tutorial (  
[https://martinos.org/mne/stable/auto\_examples/inverse/plot\_compute\_mne\_inverse\_epochs\_in\_label.html?highlight=make%20inverse](https://martinos.org/mne/stable/auto_examples/inverse/plot_compute_mne_inverse_epochs_in_label.html?highlight=make%20inverse)),  
you demonstrated how flipping signs affects the trial-average results.

Then do we need to worry about the signs when averaging across subjects? Or  
do I misunderstand something?

One further questions is whether we need to flip the sign during the  
cluster-based statistical analysis and during ANOVA within ROI.

Thanks for your help!

Lin

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [May 31, 2017, 1:46pm UTC](https://mne.discourse.group/t/mne-source-estimate-analysis-with-multiple-conditions/1202/16 "2017-05-31T13:46:49Z")

</div>

hi,

in this example the sign flip is not applied to epochs but  
to vertices in the labels. What this figure:

[https://martinos.org/mne/stable/\_images/sphx\_glr\_plot\_compute\_mne\_inverse\_epochs\_in\_label\_002.png](https://martinos.org/mne/stable/_images/sphx_glr_plot_compute_mne_inverse_epochs_in_label_002.png)

shows you is that you can equivalently apply the sign flip on evoked or on  
epochs and then average.

In all examples the sign flip is not data dependent.

Alex

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [May 31, 2017, 1:56pm UTC](https://mne.discourse.group/t/mne-source-estimate-analysis-with-multiple-conditions/1202/17 "2017-05-31T13:56:40Z")

</div>

> In all examples the sign flip is not data dependent.
> 
> > Then do we need to worry about the signs when averaging across subjects?  
> > Or do I misunderstand something?

Just want to add that, although the flip does not depend on the MEG data,  
it does depend on the MRI data. Because the flip sign is arbitrary and  
subject cortical geometries vary, the effective direction and sign can  
change on a subject-by-subject basis. So one option is to morph all  
subjects to the same space (e.g., to fsaverage ico-5) and do the sign  
flipping on an identical source space. You lose some of the geometrical  
accuracy of the sign flipping, but the alignment direction and sign  
flipping should then be identical across subjects.

Eric  
-------------- next part --------------  
An HTML attachment was scrubbed...  
URL: [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20170531/6969dc0d/attachment.html](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20170531/6969dc0d/attachment.html)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [May 31, 2017, 9:02pm UTC](https://mne.discourse.group/t/mne-source-estimate-analysis-with-multiple-conditions/1202/18 "2017-05-31T21:02:37Z")

</div>

Hi Eric and Alex,

Now I think understand why the sign flip affects the source-level results  
within a ROI.

Thanks again, Eric! That's exactly what I want to know. So I'll morph all  
subjects to the same space first, and then conduct any ROI-based  
statistical analysis on the sign flipped values?

Thanks!  
Lin
