Epoch mode covariance estimation

Hi all,
I wonder if someone could clarify a detail concerning the calculation of
the covariance matrix in epoch mode when the KEEPSAMPLEMEAN option is
specified.
On page 89 of the MNE manual (version 2.7.3) the formulation for the
covariance matrix is unclear on the limit of the sum of samples (j). My
question is whether the limit is the number of samples (Nr) in the
entire epoch, or just the baseline/pre-stimulus period?

Thanks
Kambiz

hi Kambiz,

you can take a look at the python function for this:

https://github.com/mne-tools/mne-python/blob/master/mne/cov.py#L240

it reproduces the C code.

HTH

Alex

Hi Kambiz,

To clarify on the different parameters..

"tmin" and "tmax" should reflect whatever period of the data you want to
consider as noise. "bmin" and "bmax" are the period whose DC offset is
removed from the data. What period you want to consider noise depends on
what the data and analyses are.

If 'keepsamplemean' is NOT set, the average over trials of each point is
removed i.e if you were to plot the average over trials as a function of
time, it would be flat zero between tmin and tmax after the operation..
Setting the 'keepsamplemean' reflects the assumption that the true sample
by sample mean in the tmin to tmax period is zero at the population level
(i.e if you have infinite #trials day) but not forced on the average over
the finite #trials that you have. So whenever that assumption is not
good, not setting 'keepsamplemean' will help avoid overestminating the
covariance. For instance, from the manual: "Subtraction of the means at
individual samples is useful if it can be expected that the evoked
response from previous stimulus extends to part of baseline period of the
next one."

Regards,
Hari