[FieldTrip] using tPCA on EEG data

Schoffelen, J.M. (Jan Mathijs) jan.schoffelen at donders.ru.nl
Wed Aug 26 08:42:29 CEST 2020


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20200826/81d19e03/attachment.htm>


More information about the fieldtrip mailing list