# Group-level average of (individual-level average) source timecourses

**URL:** <https://mne.discourse.group/t/group-level-average-of-individual-level-average-source-timecourses/11491>\
**Category:** Support & Discussions\
**Tags:** ﻿source-localization, meg\
**Created:** [September 17, 2025, 4:09pm UTC](https://mne.discourse.group/t/group-level-average-of-individual-level-average-source-timecourses/11491 "2025-09-17T16:09:47Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![lnalborczyk](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/lnalborczyk/32/3700_2.png) [@lnalborczyk](https://mne.discourse.group/u/lnalborczyk)\
**Post date:** [September 17, 2025, 4:09pm UTC](https://mne.discourse.group/t/group-level-average-of-individual-level-average-source-timecourses/11491/1 "2025-09-17T16:09:47Z")

</div>

Dear MNE community,

I am extracting (per-ROI) average activity in source space via `mne.extract_label_time_course()` at the individual (participant) level, using `mode="mean_flip"`, which results in timecourses that are overall positive for some participants, but negative for some other participants (in the same ROI).

What is the recommended pipeline for computing group-level average activity? Is it better to use `mode="mean"` (to avoid averaging positive and negative values) or to first transform (e.g., squaring) the individual-level source activity before averaging at the group level?

Thanks for your help!

Best wishes,

Ladislas

---

<div class="post-metadata">

**Author:** ![CarinaFo](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/carinafo/32/746_2.png) [@CarinaFo](https://mne.discourse.group/u/CarinaFo)\
**Post date:** [September 18, 2025, 7:29am UTC](https://mne.discourse.group/t/group-level-average-of-individual-level-average-source-timecourses/11491/2 "2025-09-18T07:29:00Z")

</div>

Hi Ladislas,

that is an important topic in source reconstructed time series and I don’t think there is a correct answer on how to deal with sign ambiguity. You could just take the mean or square the data, both is valid. If you want to dig a bit deeper there is a method that basically [sign flips](https://github.com/OHBA-analysis/osl-ephys/blob/main/osl_ephys/source_recon/sign_flipping.py) on the group level, it’s implemented in the osl dynamics toolbox. The paper explaining the method is by [Vidaurre et al](https://www.sciencedirect.com/science/article/pii/S1053811915010691?via%253Dihub) (search for sign ambiguity). As far as I know this is not (yet) implemented in MNE.

Cheers,

Carina

---

<div class="post-metadata">

**Author:** ![lnalborczyk](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/lnalborczyk/32/3700_2.png) [@lnalborczyk](https://mne.discourse.group/u/lnalborczyk)\
**Post date:** [September 19, 2025, 9:37am UTC](https://mne.discourse.group/t/group-level-average-of-individual-level-average-source-timecourses/11491/3 "2025-09-19T09:37:09Z")

</div>

Thank you very much for your response and for the links!

I am still struggling to understand what happens in my case. I have use `apply_inverse(…, pick_ori=None)`, which discards orientation and results in positive-only sources activations (gray lines in the attached figure). However, averaging sources within a given label (ROI) with `mode=“mean_flip”` or `mode="pca_flip"` produces average timecourses that can have both positive and negative values…

Do you know what happens there? My intuition is that the issue may come from the fact that `mne.extract_label_time_cours(..., mode="mean_flip")` was not intended to be used with positive-only values (e.g., sources activations with `pick_ori=None`).

 ![image](https://global.discourse-cdn.com/free1/uploads/mne/original/2X/4/486e492c8cd9db8c8aec820b2c1296860fd6180e.png)

---

<div class="post-metadata">

**Author:** ![CarinaFo](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/carinafo/32/746_2.png) [@CarinaFo](https://mne.discourse.group/u/CarinaFo)\
**Post date:** [September 22, 2025, 12:07am UTC](https://mne.discourse.group/t/group-level-average-of-individual-level-average-source-timecourses/11491/4 "2025-09-22T00:07:17Z")

</div>

> [@lnalborczyk](#):
>
> apply\_inverse(…, pick\_ori=None)

I do think that the sign flipping can produce negative values even when all the input is positive but I am not confident to say whether that makes sense or not. Maybe we should update the documentation, so a good thing that you raised that issue.

---

<div class="post-metadata">

**Author:** ![lnalborczyk](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/lnalborczyk/32/3700_2.png) [@lnalborczyk](https://mne.discourse.group/u/lnalborczyk)\
**Post date:** [September 22, 2025, 7:46am UTC](https://mne.discourse.group/t/group-level-average-of-individual-level-average-source-timecourses/11491/5 "2025-09-22T07:46:36Z")

</div>

Thank you for your response! It seems that (at least in this situation) `mode=”pca_flip”` produces a similar timecourse as `mode=”mean”` (i.e., the shape of the timecourse is similar, but the sign is flipped), but `mode=”mean_flip”` does more than just sign flipping, it also changes the shape of the timecourse, which I am also not sure makes sense.

---

<div class="post-metadata">

**Author:** ![CarinaFo](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/carinafo/32/746_2.png) [@CarinaFo](https://mne.discourse.group/u/CarinaFo)\
**Post date:** [September 25, 2025, 3:14am UTC](https://mne.discourse.group/t/group-level-average-of-individual-level-average-source-timecourses/11491/6 "2025-09-25T03:14:57Z")

</div>

To be fair, I am also a bit confused about the change in the signal due to ‘mean\_flip’.

I will have a look at the [source code](https://github.com/mne-tools/mne-python/blob/maint/1.10/mne/source_estimate.py#L3643).

Maybe @larsoner can explain why the signal (which should be all positive) flattens after ‘mean\_flip’?

---

<div class="post-metadata">

**Author:** ![larsoner](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/larsoner/32/3_2.png) [@larsoner](https://mne.discourse.group/u/larsoner)\
**Post date:** [September 25, 2025, 3:35pm UTC](https://mne.discourse.group/t/group-level-average-of-individual-level-average-source-timecourses/11491/7 "2025-09-25T15:35:32Z")

</div>

If your original STC is all positive, `mean_flip` should not be used. `mean` is a more correct choice.

Imagine your label contained just two vertices, one on top of a gyrus (normal pointed upward/outward) and one very close but at the bottom of a sulcus (normal pointed downward/inward). Assuming you’re using minimum norm, these would have very similar activations, but with opposite signs (i.e., their 3D vectors would point in the same direction, but one would be in the opposite direction from its vertex normal). But if you take the `abs` of the activation – or do `pick_ori=None` instead of `pick_ori=”normal”` – whichever one had a negative activation becomes positive. Then `mean_flip` – which takes into account the normal difference – will flip it back, and they will cancel out. Hence why you only want `mean_flip` for activations that are (in principle) signed, and why `mean` would be a better choice if you’ve already taken the `abs` (implicitly or explicitly)

---

<div class="post-metadata">

**Author:** ![lnalborczyk](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/lnalborczyk/32/3700_2.png) [@lnalborczyk](https://mne.discourse.group/u/lnalborczyk)\
**Post date:** [September 26, 2025, 6:29am UTC](https://mne.discourse.group/t/group-level-average-of-individual-level-average-source-timecourses/11491/8 "2025-09-26T06:29:54Z")

</div>

Thank you very much for taking the time to write this explanation!

---

<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:** [October 3, 2025, 6:30am UTC](https://mne.discourse.group/t/group-level-average-of-individual-level-average-source-timecourses/11491/9 "2025-10-03T06:30:17Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
