covariance with 'auto' option

Hello,

I calculated noise covariance matrix on baseline using method=?auto? to
find an optimal regularization:

cov = mne.compute_covariance(covepochs, method= ?auto? , tmin=None,
tmax=None , verbose=True)

The optimal was ?factor analysis?, but it gave me unacceptable solution.

When I look at whitening, it seems that ?shrunk? works better (see the
figures attached)! What can be the problem?

Elena
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20161018/404a633b/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cov_factoranalysis.png
Type: image/png
Size: 89801 bytes
Desc: not available
Url : http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20161018/404a633b/attachment-0002.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cov_shrunk.png
Type: image/png
Size: 74563 bytes
Desc: not available
Url : http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20161018/404a633b/attachment-0003.png

Hi Elena,

It looks like you are the entire time window? If you do this because you
have cropped epochs for the purpose of cov estimation then the idea of this
plot is to inspect the data segments that were not part of the window used
for cov estimation.
The plot further suggest that you are using data processed with SSS which
are rank deficient. Factor Analysis is not expected to work well. For SSS
the "shrunk" option should do a good job. I would run it with
method=('empirical', 'shrunk') and return the estimators (see parameter) to
compare them. One should always compare the fancier estimators with the
empirical covariance. In that case you would pass a list of covariance
objects to the plot_white method which will then show you one time series
per covariance.

I hope this helps,
Denis

Thank you Denis, it was helpful!

I tried it with

cov = mne.compute_covariance(allepochs, method=['empirical', 'shrunk'] ,
tmin=-0.8, tmax=0.0 , return_estimators=True, verbose=True)

The best was the ?shrunk?. However, the GFP is lower then 1 for the
?shrunk? and is close to 1 for ?empirical? (see the figure). Is it OK?

Elena

Hi Elena,

It looks like you are the entire time window? If you do this because you
have cropped epochs for the purpose of cov estimation then the idea of this
plot is to inspect the data segments that were not part of the window used
for cov estimation.
The plot further suggest that you are using data processed with SSS which
are rank deficient. Factor Analysis is not expected to work well. For SSS
the "shrunk" option should do a good job. I would run it with
method=('empirical', 'shrunk') and return the estimators (see parameter) to
compare them. One should always compare the fancier estimators with the
empirical covariance. In that case you would pass a list of covariance
objects to the plot_white method which will then show you one time series
per covariance.

I hope this helps,
Denis

Hello,

I calculated noise covariance matrix on baseline using method=?auto? to
find an optimal regularization:

cov = mne.compute_covariance(covepochs, method= ?auto? , tmin=None,
tmax=None , verbose=True)

The optimal was ?factor analysis?, but it gave me unacceptable solution.

When I look at whitening, it seems that ?shrunk? works better (see the
figures attached)! What can be the problem?

Elena
_______________________________________________
Mne_analysis mailing list
Mne_analysis at nmr.mgh.harvard.edu
Mne_analysis Info Page

The information in this e-mail is intended only for the person to whom it
is
addressed. If you believe this e-mail was sent to you in error and the
e-mail
contains patient information, please contact the Partners Compliance
HelpLine at
MyComplianceReport.com: Compliance and Ethics Reporting . If the e-mail was sent to you
in error
but does not contain patient information, please contact the sender and
properly
dispose of the e-mail.

_______________________________________________
Mne_analysis mailing list
Mne_analysis at nmr.mgh.harvard.edu
Mne_analysis Info Page

The information in this e-mail is intended only for the person to whom it
is
addressed. If you believe this e-mail was sent to you in error and the
e-mail
contains patient information, please contact the Partners Compliance
HelpLine at
MyComplianceReport.com: Compliance and Ethics Reporting . If the e-mail was sent to you in
error
but does not contain patient information, please contact the sender and
properly
dispose of the e-mail.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20161018/49b06f28/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cov_shrunk_and_empirical.png
Type: image/png
Size: 49779 bytes
Desc: not available
Url : http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20161018/49b06f28/attachment-0001.png

That looks already much better :slight_smile:
The whitened butterfly plot on the other hand looks good.
How does this butterfly plot look like for the empirical covariance?
It's generally not always easy to understand what is behind such scaling
issues as this diagnostic plot is very sensitive to subtle model
violations. That shrunk is selected means that it has for mathematical
reasons the better properties as an estimator of the covariance of unseen
data, to be preferred over the plot in case of doubt. For the GFP plot
subtle differences in rank estimates can also lead to wrong scaling. Is
your actual number of SSS components 74 as displayed in the plot?

Denis

How does this butterfly plot look like for the empirical covariance?

It looks pretty much the same as the 'shrunk' (attached).

Is your actual number of SSS components 74 as displayed in the plot?

If I do

rank = raw.estimate_rank(tstart=0.0, tstop=None, tol=0.0001,
return_singular=False, picks=None, scalings='norm')

rank =74

Elena

That looks already much better :slight_smile:
The whitened butterfly plot on the other hand looks good.
How does this butterfly plot look like for the empirical covariance?
It's generally not always easy to understand what is behind such scaling
issues as this diagnostic plot is very sensitive to subtle model
violations. That shrunk is selected means that it has for mathematical
reasons the better properties as an estimator of the covariance of unseen
data, to be preferred over the plot in case of doubt. For the GFP plot
subtle differences in rank estimates can also lead to wrong scaling. Is
your actual number of SSS components 74 as displayed in the plot?

Denis

Thank you Denis, it was helpful!

I tried it with

cov = mne.compute_covariance(allepochs, method=['empirical', 'shrunk'] ,
tmin=-0.8, tmax=0.0 , return_estimators=True, verbose=True)

The best was the ?shrunk?. However, the GFP is lower then 1 for the
?shrunk? and is close to 1 for ?empirical? (see the figure). Is it OK?

Elena

Hi Elena,

It looks like you are the entire time window? If you do this because you
have cropped epochs for the purpose of cov estimation then the idea of this
plot is to inspect the data segments that were not part of the window used
for cov estimation.
The plot further suggest that you are using data processed with SSS which
are rank deficient. Factor Analysis is not expected to work well. For SSS
the "shrunk" option should do a good job. I would run it with
method=('empirical', 'shrunk') and return the estimators (see parameter) to
compare them. One should always compare the fancier estimators with the
empirical covariance. In that case you would pass a list of covariance
objects to the plot_white method which will then show you one time series
per covariance.

I hope this helps,
Denis

Hello,

I calculated noise covariance matrix on baseline using method=?auto? to
find an optimal regularization:

cov = mne.compute_covariance(covepochs, method= ?auto? , tmin=None,
tmax=None , verbose=True)

The optimal was ?factor analysis?, but it gave me unacceptable solution.

When I look at whitening, it seems that ?shrunk? works better (see the
figures attached)! What can be the problem?

Elena
_______________________________________________
Mne_analysis mailing list
Mne_analysis at nmr.mgh.harvard.edu
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis

The information in this e-mail is intended only for the person to whom it
is
addressed. If you believe this e-mail was sent to you in error and the
e-mail
contains patient information, please contact the Partners Compliance
HelpLine at
http://www.partners.org/complianceline . If the e-mail was sent to you
in error
but does not contain patient information, please contact the sender and
properly
dispose of the e-mail.

_______________________________________________
Mne_analysis mailing list
Mne_analysis at nmr.mgh.harvard.edu
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis

The information in this e-mail is intended only for the person to whom it
is
addressed. If you believe this e-mail was sent to you in error and the
e-mail
contains patient information, please contact the Partners Compliance
HelpLine at
http://www.partners.org/complianceline . If the e-mail was sent to you
in error
but does not contain patient information, please contact the sender and
properly
dispose of the e-mail.

_______________________________________________
Mne_analysis mailing list
Mne_analysis at nmr.mgh.harvard.edu
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis

The information in this e-mail is intended only for the person to whom it
is
addressed. If you believe this e-mail was sent to you in error and the
e-mail
contains patient information, please contact the Partners Compliance
HelpLine at
http://www.partners.org/complianceline . If the e-mail was sent to you
in error
but does not contain patient information, please contact the sender and
properly
dispose of the e-mail.

_______________________________________________
Mne_analysis mailing list
Mne_analysis at nmr.mgh.harvard.edu
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis

The information in this e-mail is intended only for the person to whom it
is
addressed. If you believe this e-mail was sent to you in error and the
e-mail
contains patient information, please contact the Partners Compliance
HelpLine at
http://www.partners.org/complianceline . If the e-mail was sent to you in
error
but does not contain patient information, please contact the sender and
properly
dispose of the e-mail.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20161018/c3a6f34d/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cov_empirical.png
Type: image/png
Size: 62453 bytes
Desc: not available
Url : http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20161018/c3a6f34d/attachment-0001.png

Hum this is interesting. I'm not sure what is making the shrunk cov look
underfitting here. On the butterfly it looks good on top of that. I would
need to play with the data to better understand what maybe going on but I
have little time at this point. It seems anyways that you have good amounts
of data and the regularized covariance is not so different from the
empirical one. As long as the butterfly plot looks ok you should be safe
and trust the result that is based on the negative loglikelihood. Out of
curiosity, how many trials do you have, what is the sampling frequency and
did you check with other recordings?

I hope this helps,
Denis