# noise covariance matrix in resting state eeg data

**URL:** <https://mne.discourse.group/t/noise-covariance-matrix-in-resting-state-eeg-data/5788>\
**Category:** Support & Discussions\
**Tags:** eeg\
**Created:** [October 22, 2022, 1:31pm UTC](https://mne.discourse.group/t/noise-covariance-matrix-in-resting-state-eeg-data/5788 "2022-10-22T13:31:51Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![rethinking\_eeg](https://avatars.discourse-cdn.com/v4/letter/r/bbe5ce/32.png) [@rethinking\_eeg](https://mne.discourse.group/u/rethinking_eeg)\
**Post date:** [October 22, 2022, 1:31pm UTC](https://mne.discourse.group/t/noise-covariance-matrix-in-resting-state-eeg-data/5788/1 "2022-10-22T13:31:51Z")

</div>

Hi  
thanks for the great library and its active community

i have a question about the noise covariance matrix as it should be computed on some segments of brain signals which do not contain any activity of interest. so when trying to analyze just the resting state eeg data, what is the best option to compute the noise covariance on. as there is no portion of the data more important than the others (also dataset i am working with does not have eeg signal in an empty quiet room)

thanks in advance

---

<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:** [October 22, 2022, 3:34pm UTC](https://mne.discourse.group/t/noise-covariance-matrix-in-resting-state-eeg-data/5788/2 "2022-10-22T15:34:14Z")

</div>

Hello @rethinking_eeg and welcome to the forum!

I believe @Denis would use an “ad-hoc” covariance matrix in situations like these. You can check the documentation at:

[https://mne.tools/stable/generated/mne.make\_ad\_hoc\_cov.html](https://mne.tools/stable/generated/mne.make_ad_hoc_cov.html)

Also scroll down to see the list of examples.

Best wishes,  
Richard

---

<div class="post-metadata">

**Author:** ![rethinking\_eeg](https://avatars.discourse-cdn.com/v4/letter/r/bbe5ce/32.png) [@rethinking\_eeg](https://mne.discourse.group/u/rethinking_eeg)\
**Post date:** [October 23, 2022, 5:32pm UTC](https://mne.discourse.group/t/noise-covariance-matrix-in-resting-state-eeg-data/5788/3 "2022-10-23T17:32:16Z")

</div>

thank you richard for your guidance

unfortunately i have a hard time understanding the underlying idea behind using “ad-hoc” covariance matrix, can you recommend any resources for further explanation.  
so is my assumption correct that it is basically just a basic noise covariance matrix (not particularly specific to my data) so that i can compute the inverse solution with it.

Best wishes  
thank you so much for your time

---

<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:** [October 23, 2022, 6:51pm UTC](https://mne.discourse.group/t/noise-covariance-matrix-in-resting-state-eeg-data/5788/4 "2022-10-23T18:51:02Z")

</div>

Hello @rethinking_eeg, I’m no expert in this field, so I’ll just tag @agramfort and @larsoner, who will probably be able to point you to some helpful documentation and explanations!

He’s wishes,  
Richard

---

<div class="post-metadata">

**Author:** ![rethinking\_eeg](https://avatars.discourse-cdn.com/v4/letter/r/bbe5ce/32.png) [@rethinking\_eeg](https://mne.discourse.group/u/rethinking_eeg)\
**Post date:** [October 23, 2022, 9:54pm UTC](https://mne.discourse.group/t/noise-covariance-matrix-in-resting-state-eeg-data/5788/5 "2022-10-23T21:54:39Z")

</div>

thank you richard 🙏 🙏

---

<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:** [October 24, 2022, 4:11pm UTC](https://mne.discourse.group/t/noise-covariance-matrix-in-resting-state-eeg-data/5788/6 "2022-10-24T16:11:19Z")

</div>

I am not well versed in the resting-state EEG literature so can’t comment. I’d recommend looking at recent resting-state EEG papers to see what they use as a noise covariance. I’d expect most papers with source localization to have some definition of a noise covariance matrix.

---

<div class="post-metadata">

**Author:** ![rethinking\_eeg](https://avatars.discourse-cdn.com/v4/letter/r/bbe5ce/32.png) [@rethinking\_eeg](https://mne.discourse.group/u/rethinking_eeg)\
**Post date:** [October 30, 2022, 10:19am UTC](https://mne.discourse.group/t/noise-covariance-matrix-in-resting-state-eeg-data/5788/7 "2022-10-30T10:19:53Z")

</div>

hello @larsoner thank you for your time and attention, it means a lot.  
in fact, it is really hard to come by a clear explanation of noise covariance matrix for clinical applications of resting state eeg. i think noise covariance matrix will have huge impact in source localization.  
so is it a good idea to consider some random ad hoc covariance as noise covariance.  
I am an amateur any guidance or direction would help me a lot.  
thanks a lot in advance.

---

<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:** [October 31, 2022, 11:40am UTC](https://mne.discourse.group/t/noise-covariance-matrix-in-resting-state-eeg-data/5788/8 "2022-10-31T11:40:07Z")

</div>

> [@rethinking\_eeg](#):
>
> so is it a good idea to consider some random ad hoc covariance as noise covariance.

I’m not quite sure what you mean by “random ad hoc”, I would use `mne.make_ad_hoc_cov` which is just a diagonal matrix – not randomness involved. (It is equivalent to the noise cov you would get for IID Gaussian noise on the sensors with the given `std` values, given an infinite number of samples, if that’s what you’re thinking.)

---

<div class="post-metadata">

**Author:** ![rethinking\_eeg](https://avatars.discourse-cdn.com/v4/letter/r/bbe5ce/32.png) [@rethinking\_eeg](https://mne.discourse.group/u/rethinking_eeg)\
**Post date:** [October 31, 2022, 12:06pm UTC](https://mne.discourse.group/t/noise-covariance-matrix-in-resting-state-eeg-data/5788/9 "2022-10-31T12:06:18Z")

</div>

Hello dear @larsoner  
thank you for your informative and helpful answer.

may i add that by “random ad hoc” i meant IID Gaussian noise on the sensors with the default `std` and not specific to my data. so i should calculate standard deviation of my data at each epoch and use it in `mne.make_ad_hoc_cov` to get the suitable noise covariance matrix.

thanks a lot for your time and attention  
best wishes

---

<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:** [October 31, 2022, 12:31pm UTC](https://mne.discourse.group/t/noise-covariance-matrix-in-resting-state-eeg-data/5788/10 "2022-10-31T12:31:50Z")

</div>

I would use a single call to make\_ad\_hoc\_cov with the default values
