<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">Hi Jan-Mathijs,</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">Thanks for your answer. </div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">Just for clarity also to the other users, am I right to say that my previous interpretation was wrong, then? Is the purpose of the PCA simply that of 'stabilizing' the data matrix? The number of components has nothing to do with the rank deficiency (or what is the relationship between the two)?</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">Thanks,<br>Lorenzo</div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><p style="margin:0cm 0cm 0.0001pt"><font size="1" face="arial, helvetica, sans-serif"><br></font></p><p style="margin:0cm 0cm 0.0001pt"><font size="1" face="arial, helvetica, sans-serif"><br></font></p><p style="margin:0cm 0cm 0.0001pt"><font size="1" face="arial, helvetica, sans-serif">Lorenzo Magazzini</font></p><p style="margin:0cm 0cm 0.0001pt"><font size="1" face="arial, helvetica, sans-serif">PhD Student</font></p><p style="margin:0cm 0cm 0.0001pt"><font size="1" face="arial, helvetica, sans-serif"><a href="mailto:magazzinil@cardiff.ac.uk" target="_blank">magazzinil@cardiff.ac.uk</a></font></p><p style="margin:0cm 0cm 0.0001pt"><font size="1" face="arial, helvetica, sans-serif"><br></font></p><p style="margin:0cm 0cm 0.0001pt"><font size="1" face="arial, helvetica, sans-serif">CUBRIC Building<br>Maindy Road<u></u><u></u></font></p><p style="margin:0cm 0cm 0.0001pt"><font size="1" face="arial, helvetica, sans-serif">Cardiff<br>CF24 4HQ</font></p><p style="margin:0cm 0cm 0.0001pt"><font face="verdana, sans-serif" size="1"><br></font></p></div></div></div></div></div></div></div></div></div>
<br><div class="gmail_quote">On 19 September 2016 at 13:45, Schoffelen, J.M. (Jan Mathijs) <span dir="ltr"><<a href="mailto:jan.schoffelen@donders.ru.nl" target="_blank">jan.schoffelen@donders.ru.nl</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



<div style="word-wrap:break-word">
Hi all,<br>
<div>
<div style="word-wrap:break-word">
<div><br>
</div>
<div>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.</div>
<div>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.</div>
<div><br>
</div>
<div>Best,</div>
<div>Jan-Mathijs</div><div><div class="h5">
<div><br>
</div>
<div><br>
<div>
<blockquote type="cite">
<div>On 19 Sep 2016, at 13:48, Lorenzo Magazzini <<a href="mailto:magazzinil@gmail.com" target="_blank">magazzinil@gmail.com</a>> wrote:</div>
<br>
<div>
<div dir="ltr">
<div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">
Hi Mike,</div>
<div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">
<br>
</div>
<div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">
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:</div>
<div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">
<br>
</div>
<div class="gmail_default"><font face="arial, helvetica, sans-serif"><a href="https://mailman.science.ru.nl/pipermail/fieldtrip/2013-March/006270.html" target="_blank">https://mailman.science.ru.nl/<wbr>pipermail/fieldtrip/2013-March<wbr>/006270.html</a></font></div>
<div class="gmail_default"><a href="https://mailman.science.ru.nl/pipermail/fieldtrip/2013-November/007170.html" target="_blank">https://mailman.science.ru.nl/<wbr>pipermail/fieldtrip/2013-<wbr>November/007170.html</a></div>
<div class="gmail_default"><a href="http://www.fieldtriptoolbox.org/faq/why_does_my_ica_output_contain_complex_numbers?s[" target="_blank">http://www.fieldtriptoolbox.<wbr>org/faq/why_does_my_ica_<wbr>output_contain_complex_<wbr>numbers?s[</a><br>
</div>
<div class="gmail_default"><font face="arial, helvetica, sans-serif"><br>
</font></div>
<div class="gmail_default"><font face="arial, helvetica, sans-serif">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.</font></div>
<div class="gmail_default"><font face="arial, helvetica, sans-serif"><br>
</font></div>
<div class="gmail_default"><font face="arial, helvetica, sans-serif">Clearly, this is a very non-technical interpretation, and a correction would be more than welcome.. :)</font></div>
<div class="gmail_default"><font face="arial, helvetica, sans-serif"><br>
</font></div>
<div class="gmail_default"><font face="arial, helvetica, sans-serif">Best,</font></div>
<div class="gmail_default"><font face="arial, helvetica, sans-serif">Lorenzo</font></div>
<div class="gmail_default"><font face="arial, helvetica, sans-serif"><br>
</font></div>
<div class="gmail_default"><font face="arial, helvetica, sans-serif"><br>
</font></div>
<div class="gmail_extra"><br clear="all">
<div>
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div style="margin:0cm 0cm 0.0001pt"><font size="1" face="arial, helvetica, sans-serif"><br>
</font></div>
<div style="margin:0cm 0cm 0.0001pt"><font size="1" face="arial, helvetica, sans-serif"><br>
</font></div>
<div style="margin:0cm 0cm 0.0001pt"><font size="1" face="arial, helvetica, sans-serif">Lorenzo Magazzini</font></div>
<div style="margin:0cm 0cm 0.0001pt"><font size="1" face="arial, helvetica, sans-serif">PhD Student</font></div>
<div style="margin:0cm 0cm 0.0001pt"><font size="1" face="arial, helvetica, sans-serif"><a href="mailto:magazzinil@cardiff.ac.uk" target="_blank">magazzinil@cardiff.ac.uk</a></font></div>
<div style="margin:0cm 0cm 0.0001pt"><font size="1" face="arial, helvetica, sans-serif"><br>
</font></div>
<div style="margin:0cm 0cm 0.0001pt"><font size="1" face="arial, helvetica, sans-serif">CUBRIC Building<br>
Maindy Road<u></u><u></u></font></div>
<div style="margin:0cm 0cm 0.0001pt"><font size="1" face="arial, helvetica, sans-serif">Cardiff<br>
CF24 4HQ</font></div>
<div style="margin:0cm 0cm 0.0001pt"><font face="verdana, sans-serif" size="1"><br>
</font></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<div class="gmail_quote">On 19 September 2016 at 11:25, Hall, Michael (Research Student)
<span dir="ltr"><<a href="mailto:hallmbh@aston.ac.uk" target="_blank">hallmbh@aston.ac.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<div style="direction:ltr;font-family:tahoma;font-size:10pt">
<div style="direction:ltr;font-family:tahoma;font-size:10pt">
<div>Dear All, </div>
<div><br>
</div>
<div>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).</div>
<div><br>
</div>
<div>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? <span style="font-size:10pt">Please see below for the link and code that I'm referring to. </span></div>
<div><span style="font-size:10pt"><br>
</span></div>
<div>
<div><a href="http://www.fieldtriptoolbox.org/workshop/meg-uk-2015/fieldtrip-beamformer-demo" target="_blank"><font size="2">http://www.fieldtriptoolbox.or<wbr>g/workshop/meg-uk-2015/fieldtr<wbr>ip-beamformer-demo</font></a></div>
<div>
<p class="MsoNormal"><font size="2"><br>
</font></p>
</div>
<div><font size="2">%% deal with maxfilter</font></div>
<div><font size="2"> </font></div>
<div><font size="2">% the data has been maxfiltered and subsequently concatenated</font></div>
<div><font size="2">% this results in an ill-conditioned estimate of covariance or CSD</font></div>
<div><font size="2"> </font></div>
<div><font size="2">cfg = [];</font></div>
<div><font size="2">cfg.method = 'pca';</font></div>
<div><font size="2">cfg.updatesens = 'no';</font></div>
<div><font size="2">cfg.channel = 'MEGMAG';</font></div>
<div><font size="2">comp = ft_componentanalysis(cfg, data);</font></div>
<div><font size="2"> </font></div>
<div><font size="2">cfg = [];</font></div>
<div><font size="2">cfg.updatesens = 'no';</font></div>
<div><font size="2">cfg.component = comp.label(51:end);</font></div>
<div><font size="2">data_fix = ft_rejectcomponent(cfg, comp);</font></div>
</div>
<div><br>
</div>
<div><br>
</div>
<div>Many thanks,</div>
<div>Mike Hall</div>
<div>
<div style="font-family:tahoma;font-size:13px">
<div style="font-family:tahoma;font-size:13px"><br>
<p class="MsoNormal"><br>
</p>
<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size:12pt"><font size="2"><span style="font-size:10pt"><br>
</span></font></span></font></p>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
______________________________<wbr>_________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank">https://mailman.science.ru.nl/<wbr>mailman/listinfo/fieldtrip</a><br>
</blockquote>
</div>
<br>
</div>
</div>
______________________________<wbr>_________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">https://mailman.science.ru.nl/<wbr>mailman/listinfo/fieldtrip</a></div>
</blockquote>
</div>
<br>
</div>
</div></div></div>
<br>
<br>
</div>
<br>
</div>

<br>______________________________<wbr>_________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a><br>
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank">https://mailman.science.ru.nl/<wbr>mailman/listinfo/fieldtrip</a><br></blockquote></div><br></div>