average reference projection for noise covariance matrix

thanks for the great library and its through documentation

currently i am working on a dataset that is referenced on average mastoid electrodes; but hadn’t include them in the dataset. so i don’t think it is a good idea to try average referencing other electrodes without knowing the initial reference electrodes values. is my assumption correct?

so when i wanted to apply “mne.minimum_norm.apply_inverse_epochs” i get the warning that “RuntimeWarning: No average EEG reference present in info[“projs”], covariance may be adversely affected. Consider recomputing covariance using with an average eeg reference projector added.”

so i was wondering what should be the approach here?

thanks so much for your attention in advance.

Hello @rethinking_eeg,

I think you could just add back a reference channel (which would represent the averaged mastoids) by doing something like


This will add a channel named Ref with all-zero data.

After that, you can apply an average reference projection.

Best wishes,

1 Like

@richard thank you so much for your prompt response
as i think about it, your solution sounds so brilliant.
i want to make sure that i got it right, so you suggest that i add a channel as a reference which at first will be just zeros (cause it is reference) and then by changing the reference to average, kind of interpolate the initial values of the average mastoids, is that correct?

after doing so would the noise covariance matrix be adversely affected if i set the reference to REST?


the underlying idea is that, if all signals are measured relative to a reference electrode, by definition the signal at that reference is “zero” across all time points. Now in many electrode cap layouts, one uses one of the electrodes on the scalp as a reference (e.g., Cz). But many recording software packages then don’t include this electrode in the data, because its values are all-zero anyway. To ensure one can work with the “full” set of channels, one can use the add_reference_channel() method. It usually only makes sense to apply this if one re-references afterwards, or else you’ll end up with a channel that’s zero across all times.

But let’s assume you add back the “averaged mastoids” reference channel with all zeros, then you can safely calculate the average reference.

The problem with the averaged mastoids is that you don’t have their individual signals. So even if you use add_reference_channels(), it’s unclear which location you’ll want to assign to that new channel because it’s essentially a virtual channel that didn’t exist physically / doesn’t correspond to any electrode placed on the participant’s head.

I think you could simply not add the reference channel and still apply the average reference. Since the average reference subtracts the average of all channels from each individual channel, and since a reference channel is always zero, the only problem you’ll have is that the signal amplitude gets slightly inflated because, for each time point, you subtract

\frac{1}{N-1} \sum_{i=1}^{N}{x}_i

instead of

\frac{1}{N} \sum_{i=1}^{N}{x}_i

(remember that the sum term yields the same results with and without reference, as the reference value is zero).

But if you only look at relative differences or calculate e.g. the GFP, I don’t see a problem here.

As for REST, I’m not familiar with that kind of reference, so I don’t dare to give any advice here.

Best wishes,


thank you so much richard for your thorough and detailed explanation
it is much appreciated.