[FieldTrip] using tPCA on EEG data

Schoffelen, J.M. (Jan Mathijs) jan.schoffelen at donders.ru.nl
Tue Sep 1 08:29:07 CEST 2020


Hi Philip,

Yes, an svd is very similar in spirit to an eigenvalue decomposition (which is the workhorse for the pca implementation).

If your data are organised in a ‘comp’ structure that can be recognized by fieldtrip, you should be able to use ft_rejectcomponent.

Unless there’s a hidden agenda to your question, and you already tried this unsuccessfully.

Best wishes,
Jan-Mathijs


On 31 Aug 2020, at 22:45, philip Joadavi <p.joadavi at gmail.com<mailto:p.joadavi at gmail.com>> wrote:

Dear Jan-Mathijs,

Thank you so much for your quick reply. I tried it and it's working. I used 'SVD' instead of 'PCA'.
Just to be sure I have a follow-up question, I want to use ft_rejectcomponent after that (I mean after ft_componentanalysis), can I just use it as it is or I have to do some other tricks also before using ft_rejectcomponent?

Thanks a lot,
Philip



On Wed, Aug 26, 2020 at 8:42 AM Schoffelen, J.M. (Jan Mathijs) <jan.schoffelen at donders.ru.nl<mailto:jan.schoffelen at donders.ru.nl>> wrote:
Hi Philip,

You could try and hack your way around, by transposing the time courses. Assuming you have just a single epoch in your data structure (or all epochs have the exact same length)  (otherwise it will not work), you can do: for k = 1:numel(data.trial) data.trial{k} = data.trial{k}’ ; end

Then you need to fool Fieldtrip into ’thinking’ that the -what used to be the channel dimension- is the time dimension: data.time{:} = (1:size(data.trial{1},2))./data.fsample;

and likewise for the new channel dimension:
for k = 1:size(data.trial{1},1)
data.label{k} = sprintf(‘chan%05d’,k);
end

Then Bob’s your uncle, that is, probably ft_componentanalysis will swallow the data.

Note however, that the pca algorithm implemented in FT is not very clever, so it will probably not deal well with ill-conditioned covariance matrices, which you’re likely to end up with, since the number of time points is typically much larger than the number of channels.

Best wishes,
Jan-Mathijs


On 25 Aug 2020, at 18:56, philip Joadavi <p.joadavi at gmail.com<mailto:p.joadavi at gmail.com>> wrote:

Dear all,

I would like to work with PCA on my EEG data using Fieldtrip. As far as I know, the implementation of PCA in Fieldtrip is only on spatial (i.e the variables are the EEG channels ( spatial PCA)).

Is that possible to work around the function 'ft_componentanalysis'  to perform the temporal PCA using field trip?

Thanks!
Philip Joadavi

_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202

_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20200901/226e30b7/attachment.htm>


More information about the fieldtrip mailing list