Tutorial 21: Noise and data covariance matrices

Authors: Francois Tadel, Elizabeth Bock, John C Mosher, Richard Leahy, Sylvain Baillet

Modeling and measuring certain characteristics of the noise contaminating the data is beneficial to source estimation. For instance, minimum norm estimators can integrate second-order sample statistics of sensor noise (summarized into a noise covariance matrix, see below). Beamformers further require similar sample statistics for the data portion of interest (summarized into a data covariance matrix). This first section of this tutorial explains how to obtain a noise covariance estimate from MEG empty room recordings.

Noise covariance

Instrumental noise ("sensor noise") can be readily captured in MEG using two or more minutes of empty room measurements. We encourage the use of noise recordings collected the same day as the subject's recordings (if possible just before the session) and pre-processed in the same manner (with same sampling rate and same frequency filters applied) as the participant data. In this study we have already prepared a 2-min segment of noise recordings that we will use to estimate noise covariance sample statistics.

Right-click on the entry for noise recordings > Noise covariance. Available menus:

Select the menu Noise covariance > Compute from recordings. Available options:

For this tutorial, keep the default options and click on [OK].

Right-click on the the noise covariance file > Copy to other folders: We need this file in the two folders where the epochs were imported before we compute the respective source models.


Variations on how to estimate sample noise covariance

The sample noise covariance matrix is straightforward to obtain. Brainstorm's interface features a lot of flexibility to select the files and time windows used to calculate the sample statistics. You need to have a clear understanding of the concept of "noise" to pick the best possible option. We support the notion that noise covariance accounts for contaminants that remain present in the data after preprocessing is complete. Hence it is not meant to account for eye blinks, heartbeats, muscle artifacts, flat or bad channels and noisy segments: all of these need to be taken care of during previous preprocessing steps, as show in previous tutorial sections. The noise covariance entry is to account for remaining and stationary instrumental, sensor and environmental noise components. For this reason, the ideal scenario is to use segments of recordings that contain exclusively this type of contaminant, or segments of recordings deemed not to contain any of brain signals of interest. This section is advanced reading material that can be used as a reference in a different experimental context.

The case of MEG

From empty-room recordings: actual noise measurements (due to the instrument, environment) using empty-room conditions (no subject under the MEG helmet) are possible in MEG. We recommend you obtain 2 to more minutes of empty-room data right before bringing the subject in the MEG room, or right after the experiment is finished.
You can verify quantitatively how stable and reproducible is the noise covariance estimated (e.g., during the day/week). The MEG system may be located in a "quiet environment", allowing that you re-use the same noise recordings and therefore, noise covariance matrix, for all runs and subjects acquired on the same day.

From resting-state segments: When studying evoked responses (aka event-related responses), you may want to collect a few minutes of recordings where the subject is resting, i.e. not performing the task. Using these segments to obtain the noise covariance estimates implies that resting brain activity will be assumed as "noise", which we know now is not the case. We therefore encourage MEG users to acquire short empty-room runs instead.

From pre-stimulus baseline: Using concatenated pre-stimulation baseline segments from individual trials is in principle similar to the previous scenario, hence has similar limitations: regions prominently active during pre-stimulation baseline will tend to be attenuated by source analysis.

The case of EEG

It is less straightforward to estimate sensor noise from EEG data, because the electrodes need to be attached to a conductive medium (i.e. the scalp) to produce signals. Therefore only the last two options shown above in the MEG section are possible in EEG:
resting baseline and pre-stimulation baseline.

EEG noise levels depend on the quality of the electrode connection with the skin. It varies considerably between subjects, and during acquisition. Indeed, the conductive gel/paste/solution used for contact tends to dry up, which affects impedance. The electrode cap/locations can also move slightly, depending on how cooperative the participants. To account for variable noise levels between subjects, it is therefore preferrable to use one channel file per subject, because it allows the definition of one noise covariance entry per participant. In some specific cases, if the quality of the recordings varies a lot over time, it is preferrable to segment long recordings into shorter runs, and obtain different noise covariance matrices for each.

EEG in resting-state conditions

If the target brain activity to your experiment is resting, resting segments cannot be used to obtain noise statistics. For MEG, use empty-room measurements as explained above. For EEG, there are possible options: use sensor variance estimates, or avoid estimating empirical noise statistics.
Option #1: Calculate noise covariance over a long segment of resting recordings, but save only the diagonal elements, i.e. the variance measured at each sensor. This option is available in Brainstorm's advanced options of source computation: select the option "Diagonal noise covariance".
Option #2: Select "No noise modeling" in the contextual menu. This option uses the identity matrix as noise covariance matrix, and therefore assumes equal, unit variance of noise on every sensor. In inverse modeling, this is equivalent to assuming that noise is homoskedastic, and equivalent on all sensors. With this latter option, if data quality is not even on all electrodes, a higher noise level on some sensors may be explained with stronger, spurious source activity.


Interictal spikes are often considered as events of interest in epilepsy studies. In that respect, they can be considered as a form of brain activity evoked by the epileptogenic process, very much like a stimulus-related response. For this reason, one shall be cautious about how to define noise conditions from ongoing EEG or MEG recordings to study epilepsy. Defining a segment of time adjacent to the spike as "background noise" is certainly not justified. In practice, however, one often uses a data segment clear from visible interictal activity. As discussed above, MEG has the additional, preferred option of using empty-room data as a baseline - an option not available with EEG.

The same options as above are available to the epilepsy researcher:
Option #1a: Estimate noise covariance statistics from blocks of recordings away from the peak of any identified interictal spike, and keep only the diagonal (the variance of each sensor time series).
Option #1b: If a large period of time clear of visible interictal events is available, use this latter to estimate the full noise covariance array.
Option #2(MEG): Use empty-room data as baseline.
Option #3: Select "No noise modeling" in the popup menu (identity matrix, unit variance of noise on every sensor).




Data covariance

Beamforming source mapping further requires the estimation of data covariance statistics. The LMCV beamformer uses an estimated data covariance matrix to compute spatial filters that define the beamformer. It is important that this covariance matrix contains contributions from all sources that contribute to the data over the time window to be analyzed (signal + noise).

We have found, as have others, that it is important to use a relatively long time window for robust beamformer performance. This also helps to avoid numerical instability when inverting the data covariance, as required in computing the beamformer kernel matrix. Our recommendations:

The procedure to compute the data covariance is very similar to the noise covariance:


On the hard drive

Right-click on any noise covariance file > File > View file contents:

Structure of the noise/data covariance files: noisecov_*.mat / ndatacov_*.mat

Related functions


Additional documentation

Feedback: Comments, bug reports, suggestions, questions
Email address (if you expect an answer):

Tutorials/NoiseCovariance (last edited 2017-03-20 21:38:38 by ?MartinCousineau)