[FieldTrip] Maxfilter and PCA

Schoffelen, J.M. (Jan Mathijs) jan.schoffelen at donders.ru.nl
Mon Sep 19 14:45:00 CEST 2016

Hi all,

The reason to do the PCA has to do in this context with the fact that a beamformer is used further down in the tutorial. The beamformer uses the inverse of the covariance matrix, which behaves unpredictably (but usually quite bad) when the smallest (usually poorly conditioned) components are not well estimated.
The data that is used for the source reconstruction comes from three separate runs, each of which was separately maxfiltered. As a consequence, the low-rank subspace that is spanned by the individual runs’ data is slightly different (each of which has approximately, say, a rank of 60). Upon concatenation, however, the rank is suddenly increased to >> 60, where most likely quite a lot of the ‘higher’ components represent noise. In order to account for that in the covariance inversion, the whole data matrix is ‘stabilized’ with a PCA.


On 19 Sep 2016, at 13:48, Lorenzo Magazzini <magazzinil at gmail.com<mailto:magazzinil at gmail.com>> wrote:

Hi Mike,

This is a question that I've been asking myself too and I'd love to hear an expert (and more technical) answer. In the meantime, these discussions may be of help:


I wonder if the confusion arises from the difference between rank and number of components? My understanding is that maxfilter reduces the rank of the data (from 306 to 64, apparently). Therefore, my best guess is that by performing a PCA and rejecting a number of components (only the first 50 are kept, in the tutorial example), the data is no longer rank-deficient, i.e. the rank is equal or greater than the number of components in the data.

Clearly, this is a very non-technical interpretation, and a correction would be more than welcome.. :)


Lorenzo Magazzini
PhD Student
magazzinil at cardiff.ac.uk<mailto:magazzinil at cardiff.ac.uk>

CUBRIC Building
Maindy Road
CF24 4HQ

On 19 September 2016 at 11:25, Hall, Michael (Research Student) <hallmbh at aston.ac.uk<mailto:hallmbh at aston.ac.uk>> wrote:
Dear All,

I've been doing some testing with elekta neuromag data in Fieldtrip using different sensor types (meg, meggrad, megmag) and different preprocessing steps (tSSS 0.9 corr limit, no tSSS).

A step that was proposed at the MEG UK 2015 demo was to use PCA to compensate for the ill-conditioned estimate of the cov/csd matrix due to maxfilter - could I ask why running a PCA and reducing the number of components further would compensate for this? Apologies if this a naive question, however I would assume that you would not want to reduce the rank of your data further? Please see below for the link and code that I'm referring to.


%% deal with maxfilter

% the data has been maxfiltered and subsequently concatenated
% this results in an ill-conditioned estimate of covariance or CSD

cfg = [];
cfg.method = 'pca';
cfg.updatesens = 'no';
cfg.channel = 'MEGMAG';
comp = ft_componentanalysis(cfg, data);

cfg = [];
cfg.updatesens = 'no';
cfg.component = comp.label(51:end);
data_fix = ft_rejectcomponent(cfg, comp);

Many thanks,
Mike Hall

fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl>

fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20160919/c4793969/attachment-0002.html>

More information about the fieldtrip mailing list