# [FieldTrip] Component analysis: search for the explained variance

Constantino Méndez Bértolo constantino.mendezbertolo at ctb.upm.es
Thu Feb 5 18:34:26 CET 2015

```Dear all,

here is a snippet from the ft_componentanalysis code which may prove useful
to anybody facing this situation

[from ft_componentanalysis)

% compute data cross-covariance matrix
>     C = (dat*dat')./(size(dat,2)-1);
>
>     % eigenvalue decomposition (EVD)
>     [E,D] = eig(C);
>
>     % sort eigenvectors in descending order of eigenvalues
>     d = cat(2,(Nchan)',diag(D));
>     d = sortrows(d,[-2]);
>

one could then use something like this to obtain the percentage of
explained variance for each component..

>     varianza=d(Nchan,2)/sum(diag(C));]

paz!

2015-02-05 15:56 GMT+01:00 Constantino Méndez Bértolo <
constantino.mendezbertolo at ctb.upm.es>:

> tl;dr: anybody knows whether this info is stored (or not) and where? thx
>
> Queridos fieldtrippers,
>
> I am trying to find where the info about the amount of variance that each
> component explains is stored (if it is) after running ft_componentanalysis
> (method='pca')
>
> I know the interesting data is in two fields: topo + unmixing. May it
> happen that I am supposed to derive the variance explained by each
> component using some kind of mathematical sorcery and this values.
>
> If my question is too naive, I apologize, I think that the channels
> (actually 'components') of the output structure are sorted in descending
> order of variance explained during the call to the function, I searched
> there and in ft_databrowser unfructiosly. Also parsed the mailing list
> (there are two other answered questions
> [http://mailman.science.ru.nl/pipermail/fieldtrip/2012-July/005409.html]
> [http://mailman.science.ru.nl/pipermail/fieldtrip/2012-January/004706.html
> ]
>
> Peace,
>
> --
> Constantino Méndez-Bértolo
> Laboratorio de Neurociencia Clínica, Centro de Tecnología Biomédica (CTB)
>
> Parque Científico y Tecnológico de la UPM, Campus de Montegancedo
>
> 28223 Pozuelo de Alarcón, Madrid, SPAIN
>
>
>

--
Constantino Méndez-Bértolo
Laboratorio de Neurociencia Clínica, Centro de Tecnología Biomédica (CTB)

Parque Científico y Tecnológico de la UPM, Campus de Montegancedo

28223 Pozuelo de Alarcón, Madrid, SPAIN
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20150205/3efb73ec/attachment-0002.html>
```