# confusion about the results of combine evoke

**URL:** <https://mne.discourse.group/t/confusion-about-the-results-of-combine-evoke/3706>\
**Category:** Support & Discussions\
**Tags:** eeg, epochs\
**Created:** [September 16, 2021, 12:22pm UTC](https://mne.discourse.group/t/confusion-about-the-results-of-combine-evoke/3706 "2021-09-16T12:22:17Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![elvisjade](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/elvisjade/32/122_2.png) [@elvisjade](https://mne.discourse.group/u/elvisjade)\
**Post date:** [September 16, 2021, 12:22pm UTC](https://mne.discourse.group/t/confusion-about-the-results-of-combine-evoke/3706/1 "2021-09-16T12:22:17Z")

</div>

I would like to know which is the best way to calculate the difference waves in the oddball paradigm?

The original oddball difference wave seems to be just a direct subtraction of the EEG values of the deviant and standard stimuli, and the code implementation of mne seems to be different from this?

I have some confusion about the principle and results of combine evoke.

If I get the standard stimulus minus the abnormal stimulus to produce a differential stimulus result (oddball paradigm).  
The function provided by mne seems to be the combine evoke function.

But shouldn’t the total number of evokes be the same?  
For example, if I have 100 standard stimuli and 100 abnormal stimuli, then

odd = mne.combine.evoked([std,dev],weights=[-1,1])

After that, shouldn’t there be 100 different stimuli?

But it seems that both mne’s own sample code and the one I came up with halve the number of stimuli.

 ![image](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/99a88bf9643bd80e03e2cbf68085b400d6071ab7.png)

 ![image](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/0d23e94cd94c88514f00a8cb8be737ca3c5e984c.jpeg)

And I’m curious what the difference is between these two codes? Why does the generated evoke have a different nave?  
(dev\_all evoke number =130 std\_all evoke number = 130)  
odd\_all = mne.combine\_d([dev\_all, std\_all], weights=[1, -1])

 ![Figure_5](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/cadaad2247664e19869c13d68ab75ea4cd263567.jpeg)

odd\_all = mne.combine\_d([dev\_all, -std\_all], weights=‘equal’)

 ![Figure_4](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/8d5a658605c00d232cda08d8ed260cfa44a38e95.jpeg)

---

<div class="post-metadata">

**Author:** ![mmagnuski](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/mmagnuski/32/153_2.png) [@mmagnuski](https://mne.discourse.group/u/mmagnuski)\
**Post date:** [September 16, 2021, 3:44pm UTC](https://mne.discourse.group/t/confusion-about-the-results-of-combine-evoke/3706/2 "2021-09-16T15:44:23Z")

</div>

Hi, @elvisjade  
the `.nave` attribute of an `Evoked` object informs about the number of trials that were averaged to obtain the ERP. Since the difference wave is the difference between two averages (two ERPs), the `.nave` may no longer make much sense. But it depends on the weights that you use during combining - make sure that you read the Warning note from the documentation on `mne.combine_evoked`:  
[https://mne.tools/stable/generated/mne.combine\_evoked.html](https://mne.tools/stable/generated/mne.combine_evoked.html)

---

<div class="post-metadata">

**Author:** ![richard](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/richard/32/15_2.png) [@richard](https://mne.discourse.group/u/richard)\
**Post date:** [September 16, 2021, 8:23pm UTC](https://mne.discourse.group/t/confusion-about-the-results-of-combine-evoke/3706/3 "2021-09-16T20:23:30Z")

</div>

I think it’s also worth checking out what “nave” actually means and how we compute it. I don’t think this is properly documented outside of our source code, so here’s a link to the relevant bits:

> <https://github.com/mne-tools/mne-python/blob/b579d328cb67d6a0096ff5ba74e4e2e557e84065/mne/evoked.py#L1007-L1021>

---

<div class="post-metadata">

**Author:** ![mmagnuski](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/mmagnuski/32/153_2.png) [@mmagnuski](https://mne.discourse.group/u/mmagnuski)\
**Post date:** [September 17, 2021, 11:34am UTC](https://mne.discourse.group/t/confusion-about-the-results-of-combine-evoke/3706/4 "2021-09-17T11:34:56Z")

</div>

Good point @richard. So, to extend my previous answer - as stated in the code comment the `.nave` parameter is used as an estimate of variance (`1 / nave`) during inverse operations (projecting data to source space). The variance accumulates when you perform difference operations (subtracting two noisy signals gives you even noiser difference) so the `.nave` changes to reflect that - and as a result is lower than your original `.nave`.

---

<div class="post-metadata">

**Author:** ![elvisjade](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/elvisjade/32/122_2.png) [@elvisjade](https://mne.discourse.group/u/elvisjade)\
**Post date:** [September 29, 2021, 8:28am UTC](https://mne.discourse.group/t/confusion-about-the-results-of-combine-evoke/3706/5 "2021-09-29T08:28:46Z")

</div>

Thank you very, very much for your reply.

I have understood the essence of nave, which seems to be a manifestation of variance.

I would also like to ask if that means  
odd\_all = mne.combine\_d([dev\_all, std\_all], weights=[1, -1]) can correctly derive the value of the difference stimulus - standard stimulus?  
I can now understand the reason for the variation, but I would like to ask if the values are correctly calculated?

---

<div class="post-metadata">

**Author:** ![richard](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/richard/32/15_2.png) [@richard](https://mne.discourse.group/u/richard)\
**Post date:** [September 29, 2021, 10:56am UTC](https://mne.discourse.group/t/confusion-about-the-results-of-combine-evoke/3706/6 "2021-09-29T10:56:10Z")

</div>

> [@elvisjade](#):
>
> I would also like to ask if that means  
> odd\_all = mne.combine\_d([dev\_all, std\_all], weights=[1, -1]) can correctly derive the value of the difference stimulus - standard stimulus?

Yes, this will calculate the difference and not apply any special weights when doing so. For a contrast like “deviant vs standard”, this is typically exactly what you want.

---

<div class="post-metadata">

**Author:** ![elvisjade](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/elvisjade/32/122_2.png) [@elvisjade](https://mne.discourse.group/u/elvisjade)\
**Post date:** [September 29, 2021, 11:58am UTC](https://mne.discourse.group/t/confusion-about-the-results-of-combine-evoke/3706/7 "2021-09-29T11:58:52Z")

</div>

Thank you very, very much!  
I understand already.  
Thank you for answering my questions.
