# stc amplitude dependence on evoked.nave \[subject-to-subject comparison\]

**URL:** <https://mne.discourse.group/t/stc-amplitude-dependence-on-evoked-nave-subject-to-subject-comparison/7354>\
**Category:** Support & Discussions\
**Tags:** ﻿source-localization, evoked\
**Created:** [August 10, 2023, 11:15am UTC](https://mne.discourse.group/t/stc-amplitude-dependence-on-evoked-nave-subject-to-subject-comparison/7354 "2023-08-10T11:15:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kirill](https://avatars.discourse-cdn.com/v4/letter/k/a9a28c/32.png) [@Kirill](https://mne.discourse.group/u/Kirill)\
**Post date:** [August 10, 2023, 11:15am UTC](https://mne.discourse.group/t/stc-amplitude-dependence-on-evoked-nave-subject-to-subject-comparison/7354/1 "2023-08-10T11:15:30Z")

</div>

Hello everyone!

Earlier in the forum, someone asked about working with data on sources with different numbers of averaged epochs per CONDITION. Here is the past discussion. [here](https://mne.discourse.group/t/unbalanced-number-of-trials-between-individuals-problem-in-sources/969), [here](https://mne.discourse.group/t/equivalence-of-averaged-single-trial-stcs-and-evoked-stcs/688) and [here](https://mne.discourse.group/t/confusion-about-the-results-of-combine-evoke/3706/4).

I have a related issue with SUBJECTS having different numbers of epochs.  
[The example below is for a single subject, but let us imagine that these are different subjects]  
‘Subject A’ has 453 epochs and ‘subject B’ has 905 epochs. At sensors, the evoked responses have similar amplitude (fig).

 ![evoked_crop](https://global.discourse-cdn.com/free1/uploads/mne/original/2X/b/b618fc17fe4ef4369e4c7256195b10658fcb57b3.png) ![evoked](https://global.discourse-cdn.com/free1/uploads/mne/original/2X/0/0a978cc6c6b789832b73aa579b16738c025d9e95.png)

However, while solving the inverse problem, MNE-Python scales stc amplitudes proportionally to ‘nave’. As a result, in the source space, B\>A (fig), which means that we see a difference that is not really there.

 ![stc_plot](https://global.discourse-cdn.com/free1/uploads/mne/original/2X/7/7ab5ec562f17fe2ddb0d8e63f39e84fda1ba0b3d.png)

Questions:

1. Is it possible to somehow normalize the stc amplitudes for the number of averages in order to perform group comparison (we have different numbers of averages in different groups)? If yes, what would be the best way to do so?

2. Can I use evoked.nave=1 to offset the effect of the inverse problem of having different numbers of averages in subjects A and B?

best regards  
Kirill

```python
import mne
import numpy as np
import matplotlib.pyplot as plt

subjects_dir = ‘/freesurfer/’
subject = ‘F001’

lambda2 = 1. / 3 ** 2
method = 'sLORETA'

inv = mne.minimum_norm.read_inverse_operator(myinv+'-inv.fif')
src = mne.setup_source_space(subject, spacing=spacing, subjects_dir=subjects_dir, add_dist=False)

lh_label = mne.read_label(mylabel + '-lh.label')
rh_label = mne.read_label(mylabel + '-rh.label')

epochs = mne.read_epochs(myepochs + '-epo.fif', preload=False)

evoked = epochs.average()

f = mne.viz.plot_compare_evokeds(evoked, 
                                 picks="meg", 
                                 combine='mean',
                                 title='nave = ' + str(evoked.nave),
                                 legend=False,
                                 ylim = dict(mag=[0, 100],grad=[0, 30]))

epochs_crop = epochs.copy()[::2] 
evoked_crop = epochs_crop.average()

f = mne.viz.plot_compare_evokeds(evoked_crop, 
                                 picks="meg", 
                                 combine='mean',
                                 title='nave = ' + str(evoked_crop.nave),
                                 legend=False,
                                 ylim = dict(mag=[0, 100],grad=[0, 30]))

f, ax = plt.subplots(1,2, figsize=(10,5))
f.suptitle('data from sourses', size=20) 
for nhemi, (hemi,label) in enumerate(zip(['left auditory cortex','right auditory cortex'],[lh_label,rh_label])):
    for evk in [evoked, evoked_crop]:

        stc = mne.minimum_norm.apply_inverse(evk, inverse_operator=inv, method=method, lambda2=lambda2, pick_ori=None)
    
        flip = stc.extract_label_time_course(label, src, mode='mean_flip')[0,:]
        if flip[800:1300].mean() > 0:
            flip = flip*-1
    
        ax[nhemi].plot(flip, label = 'nave = ' + str(evk.nave))
    
        ax[nhemi].set_title(hemi, size = 15)
        ax[nhemi].set_ylabel('Amplitude', fontsize = 15)
        ax[nhemi].set_ylim([-35,35])
        ax[nhemi].set_xlabel('Time (ms)', fontsize = 15)
        ax[nhemi].set_xticks(range(0,1201,200))
        ax[nhemi].set_xticklabels(range(-200,1001,200))
        ax[nhemi].grid(True)
        ax[nhemi].legend()

f.tight_layout()

```

---

<div class="post-metadata">

**Author:** ![agramfort](https://avatars.discourse-cdn.com/v4/letter/a/7c8e57/32.png) [@agramfort](https://mne.discourse.group/u/agramfort)\
**Post date:** [August 10, 2023, 2:18pm UTC](https://mne.discourse.group/t/stc-amplitude-dependence-on-evoked-nave-subject-to-subject-comparison/7354/2 "2023-08-10T14:18:44Z")

</div>

sLORETA and dSPM will scale the output with nave.

You can use method=“MNE” in apply\_inverse or maybe z-score/baseline-correct the stcs you obtained.

Alex

---

<div class="post-metadata">

**Author:** ![Kirill](https://avatars.discourse-cdn.com/v4/letter/k/a9a28c/32.png) [@Kirill](https://mne.discourse.group/u/Kirill)\
**Post date:** [August 17, 2023, 1:41pm UTC](https://mne.discourse.group/t/stc-amplitude-dependence-on-evoked-nave-subject-to-subject-comparison/7354/3 "2023-08-17T13:41:55Z")

</div>

Thank you so much for your reply!

Following your words, it is not possible to use sLORETA and dSPM for unbalanced design (e.g. oddball or when we have a systematic bias in the number of epochs between groups of)?

---

<div class="post-metadata">

**Author:** ![dasdiptyajit](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/dasdiptyajit/32/4796_2.png) [@dasdiptyajit](https://mne.discourse.group/u/dasdiptyajit)\
**Post date:** [August 17, 2023, 3:02pm UTC](https://mne.discourse.group/t/stc-amplitude-dependence-on-evoked-nave-subject-to-subject-comparison/7354/4 "2023-08-17T15:02:52Z")

</div>

Epochs counts need to be equal across two conditions when you want to compare their source data based on ‘sLORETA’ or ‘dSPM’. `nave` (in epochs) parameter is used to scale the noise for those methods as Alex mentioned. You have to equalize the epochs across the conditions (nave=453) else you have to use either `MNE` or `eLORETA` (check this one, i am not completely sure). Afterwards, you can do a z-score to normalize the data before comparing.

best,  
Dip

---

<div class="post-metadata">

**Author:** ![Kirill](https://avatars.discourse-cdn.com/v4/letter/k/a9a28c/32.png) [@Kirill](https://mne.discourse.group/u/Kirill)\
**Post date:** [August 17, 2023, 3:05pm UTC](https://mne.discourse.group/t/stc-amplitude-dependence-on-evoked-nave-subject-to-subject-comparison/7354/5 "2023-08-17T15:05:54Z")

</div>

Thank you for your reply!

best,  
Kirill

---

<div class="post-metadata">

**Author:** ![dasdiptyajit](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/dasdiptyajit/32/4796_2.png) [@dasdiptyajit](https://mne.discourse.group/u/dasdiptyajit)\
**Post date:** [August 17, 2023, 3:20pm UTC](https://mne.discourse.group/t/stc-amplitude-dependence-on-evoked-nave-subject-to-subject-comparison/7354/6 "2023-08-17T15:20:27Z")

</div>

To this question:  
`Can I use evoked.nave=1 to offset the effect of the inverse problem of having different numbers of averages in subjects A and B?`

– No, this is not possible. `evoked.nave=1` doesn’t make sense. Typically, nave=1 when you work with a single trial data i.e, (source analysis for epochs) and not for average data.

It would be nice if you change the `solution` mark to Alex’s comment, so that others can find the right solution.

good wishes,
