[Eeglablist] PSD: ICA+PCA?

Makoto Miyakoshi mmiyakoshi at ucsd.edu
Sat Jan 21 23:01:47 PST 2017


Dear Alberto,

> Once i have the ICA weights, how can i calculate the total PSD for all
the scalp? Should i use your code for each component and then add and
average by hand? Or there is any option in eeglab to average the signals to
one?

I'm not completely sure, but PSD is non-linear i.e. 2+4 = 1+5 is true (this
is the cae of ICA, hence called linear decomposition), but 2^2+4^2 ~=
1^2+5^2. Computing 'total PSD' is technically possible, but how you use it
is tricky. You need to use something like percent variance accounted for
(PVAF) that is being used in std_envtopo() plugin. When you use this
plugin, you'll notice that the total sum of all cluster PVAF is always
larger than 100%, which is due to triangular inequity that is related to
this topic.

>From UA49 to Newark,

Makoto


On Fri, Jan 13, 2017 at 6:03 AM, Alberto Sainz <albertosainzc at gmail.com>
wrote:

> Yep, now it works! Thanks a lot.
>
> I am having some weird results with the ICA+PCA method. I would like to
> validate it without the PCA step but i do not know how, i think im missing
> something.
>
> Once i have the ICA weights, how can i calculate the total PSD for all the
> scalp? Should i use your code for each component and then add and average
> by hand? Or there is any option in eeglab to average the signals to one?
>
> Thanks a lot
>
>
>
> 2017-01-13 14:59 GMT+01:00 Alberto Sainz <albertosainzc at gmail.com>:
>
>> Yep, now it works!
>>
>>
>>
>> 2017-01-13 7:42 GMT+01:00 Makoto Miyakoshi <mmiyakoshi at ucsd.edu>:
>>
>>> Dear Alberto,
>>>
>>> Hmm then it should work. Please also uncheck 'use single precision...'.
>>>
>>> I updated the toolbox a few days ago and not it is version 0.20. Please
>>> try it to see if it works. Sorry for the trouble, and I appreciate you
>>> contacted me for this. Let's see if it works.
>>>
>>> On Tue, Jan 10, 2017 at 10:37 AM, Alberto Sainz <albertosainzc at gmail.com
>>> > wrote:
>>>
>>>> Dear Makoto,
>>>>
>>>> Im not sure if I know how to check that out. If i go to file>memory and
>>>> other options the only two ICA options i find are both activated.
>>>> Also, i never change any config so i guess this issue comes by default.
>>>> Im using 13.6.5b version.
>>>>
>>>> thanks!
>>>>
>>>> 2017-01-10 19:24 GMT+01:00 Makoto Miyakoshi <mmiyakoshi at ucsd.edu>:
>>>>
>>>>> Dear Alberto,
>>>>>
>>>>> Please check if EEGLAB option is set so that it does 'precompute'
>>>>> EEG.icaact. Nowadays there is no reason not to have EEG.icaact in my
>>>>> opinion.
>>>>>
>>>>> Makoto
>>>>>
>>>>> On Tue, Jan 10, 2017 at 9:40 AM, Alberto Sainz <
>>>>> albertosainzc at gmail.com> wrote:
>>>>>
>>>>>> Thanks a lot Makoto!!
>>>>>>
>>>>>> It gave me this error: Index exceeds matrix dimensions.
>>>>>>
>>>>>> I found icaact was empty. I checked the forum and I tried EEG =
>>>>>> eeg_checkset(EEG, 'ica'); but didnt work.
>>>>>>
>>>>>> Then I tried EEG.icaact = (EEG.icaweights*EEG.icasphere)
>>>>>> *EEG.data(EEG.icachansind,:);
>>>>>>
>>>>>> Now it works :)
>>>>>>
>>>>>> I post it in case someone needs it in the future.
>>>>>>
>>>>>> 2016-12-30 1:14 GMT+01:00 Makoto Miyakoshi <mmiyakoshi at ucsd.edu>:
>>>>>>
>>>>>>> Dear Alberto,
>>>>>>>
>>>>>>> > How do I select component 1?
>>>>>>>
>>>>>>> Use EEG.icaact(1,:,:) instead.
>>>>>>>
>>>>>>> > Since I just reduced all the ICA components to 1 doing PCA,
>>>>>>> shouldnt I select component 1 (out of 1)?
>>>>>>>
>>>>>>> Yes.
>>>>>>>
>>>>>>> > If i select a channel then I am not taking all the data from the
>>>>>>> full EEG recording, right?
>>>>>>>
>>>>>>> Right. If you use IC(s), then these ICs contributes to multiple
>>>>>>> channels so you can claim that you are using full part of data (channels).
>>>>>>>
>>>>>>> Makoto
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Mon, Dec 19, 2016 at 10:49 AM, Alberto Sainz <
>>>>>>> albertosainzc at gmail.com> wrote:
>>>>>>>
>>>>>>>> Thank you very much Makoto!
>>>>>>>>
>>>>>>>> I think i am going to use the PCA method in a small sample of
>>>>>>>> recordings and lets see what happens.
>>>>>>>>
>>>>>>>> I was doing it right now and I got stucked in your code:
>>>>>>>>
>>>>>>>> [spectra,freqs] = spectopo(EEG.data(2,:,:), 0, EEG.srate);
>>>>>>>>
>>>>>>>> This selects channel 2 of the data. How do I select component 1?
>>>>>>>> Since I just reduced all the ICA components to 1 doing PCA, shouldnt I
>>>>>>>> select component 1 (out of 1)? I checked the spectopo help and I only see I
>>>>>>>> can select channels, not components.
>>>>>>>>
>>>>>>>> If i select a channel then I am not taking all the data from the
>>>>>>>> full EEG recording, right?
>>>>>>>>
>>>>>>>> Thank you!
>>>>>>>>
>>>>>>>> 2016-12-14 4:41 GMT+01:00 Makoto Miyakoshi <mmiyakoshi at ucsd.edu>:
>>>>>>>>
>>>>>>>>> Dear Alberto,
>>>>>>>>>
>>>>>>>>> PCA before ICA has a meaning of dimension reduction to allow ICA
>>>>>>>>> to have less model order (this is empirical though). Since you can project
>>>>>>>>> dimension-reduced PCs to channels any time, the meaning of the process is
>>>>>>>>> pretty straightforward.
>>>>>>>>>
>>>>>>>>> PCA after ICA is a bit tricky. I guess you can do that as long as
>>>>>>>>> your PCA (1st or up to 3rd or whatever) results show that good portion of
>>>>>>>>> the data variance is accounted for by those... in my personal experience,
>>>>>>>>> the first PC could explain 50-60% of time-frequency results across all ICs,
>>>>>>>>> which I thought is not too bad if I can say something interesting based
>>>>>>>>> upon it.
>>>>>>>>>
>>>>>>>>> > how would you average the total frequency of all channels?
>>>>>>>>>
>>>>>>>>> You can use ICA for the purpose of dimension reduction too; you
>>>>>>>>> count ICs until the 60% of the variance is accounted for, for example. Then
>>>>>>>>> what ICs does it select? That's a good question, isn't it?
>>>>>>>>>
>>>>>>>>> Relatedly, there is std_envtopo() plugin. It tells you which IC
>>>>>>>>> cluster explain how much of variance in grand averaged ERP envelope. This
>>>>>>>>> can tell you which cluster you should focus on, because it tells you who is
>>>>>>>>> most dominant in which ERP (envelope) component.
>>>>>>>>>
>>>>>>>>> Makoto
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Mon, Dec 12, 2016 at 5:53 PM, Alberto Sainz <
>>>>>>>>> albertosainzc at gmail.com> wrote:
>>>>>>>>>
>>>>>>>>>> Dear Makoto,
>>>>>>>>>>
>>>>>>>>>> I meant to use PCA before ICA. In the paper described (link:
>>>>>>>>>> http://www.ijcaonline.org/archives/volume42/number15/5770-7993 )
>>>>>>>>>> they use frist ICA and then PCA to reduce data to only one component.
>>>>>>>>>> My question is, how valid this could be? How much data do we lose
>>>>>>>>>> doing this?
>>>>>>>>>>
>>>>>>>>>> Thanks for the code, I already took it before from the list :).
>>>>>>>>>> My idea was actually applying the code to the only component left after
>>>>>>>>>> ICA+PCA. Otherwise I would have to apply the code for each
>>>>>>>>>> channel/component (that was my previous idea).
>>>>>>>>>>
>>>>>>>>>> In case doing PCA after ICA is not a good option, how would you
>>>>>>>>>> average the total frequency of all channels? By a simple avergaing code? Or
>>>>>>>>>> maybe im missing something and there is no point on averaging the power of
>>>>>>>>>> all channels/components!!
>>>>>>>>>>
>>>>>>>>>> Sorry I know there are too many questions! I hope you understand
>>>>>>>>>> what I mean.
>>>>>>>>>>
>>>>>>>>>> Thanks
>>>>>>>>>>
>>>>>>>>>> 2016-12-07 0:14 GMT+01:00 Makoto Miyakoshi <mmiyakoshi at ucsd.edu>:
>>>>>>>>>>
>>>>>>>>>>> Dear Alberto,
>>>>>>>>>>>
>>>>>>>>>>> > can anyone explain why we would perform first an ICA and then
>>>>>>>>>>> a PCA?
>>>>>>>>>>>
>>>>>>>>>>> You can apply PCA as a preprocessing for ICA. We sometimes do it
>>>>>>>>>>> (you know, runica() has an option 'pca' to reduce dimensions.)
>>>>>>>>>>>
>>>>>>>>>>> > Also, before reading this paper, my intention was to perform
>>>>>>>>>>> an ICA, average the power for each component in a specific frecuency band
>>>>>>>>>>> and then average those means for the same frequency.
>>>>>>>>>>>
>>>>>>>>>>> See my new help wiki page for how to do it.
>>>>>>>>>>>
>>>>>>>>>>> https://sccn.ucsd.edu/wiki/Makoto%27s_useful_EEGLAB_code
>>>>>>>>>>>
>>>>>>>>>>> > I guess this accumulates a lot of error, could anyone tell me
>>>>>>>>>>> if this procedure would be valid?
>>>>>>>>>>>
>>>>>>>>>>> Not necessarily. It's not the errors that accumulates, but you
>>>>>>>>>>> drop information.
>>>>>>>>>>> Dimension reduction by PCA or ICA (ICA results are also sorted
>>>>>>>>>>> by variance, so the near-last ICs are very small; removing them would not
>>>>>>>>>>> make visible differences but still reduces data ranks) means that you use
>>>>>>>>>>> less than 100% of data variance.
>>>>>>>>>>>
>>>>>>>>>>> Imagine you have 128 channel and only analyze Fz, Cz, and Pz.
>>>>>>>>>>> This is much more wasteful. Reasonable dimension reduction is indispensable
>>>>>>>>>>> for any high-dimensional data processing.
>>>>>>>>>>>
>>>>>>>>>>> > could anyone tell me if this procedure would be valid?
>>>>>>>>>>>
>>>>>>>>>>> It's a trade off between surveyability and amount of data--if
>>>>>>>>>>> you focus on less Independent/Principal components, you get more
>>>>>>>>>>> surveyability but loosing more information. If you use more ICs/PCs, data
>>>>>>>>>>> are hard to survey. You can't put all the info you have on a paper anyway,
>>>>>>>>>>> so selection is always necessary. You need courage to focus on data, I
>>>>>>>>>>> know!
>>>>>>>>>>>
>>>>>>>>>>> Makoto
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On Mon, Nov 28, 2016 at 6:57 AM, Alberto Sainz <
>>>>>>>>>>> albertosainzc at gmail.com> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Hello,
>>>>>>>>>>>>
>>>>>>>>>>>> I have a question regarding ICA and PCA.
>>>>>>>>>>>>
>>>>>>>>>>>> Following the paper "Power Spectrum Analysis of EEG Signals for
>>>>>>>>>>>> Estimating
>>>>>>>>>>>> Visual Attention" to calculate Power Spectrum by frequencies,
>>>>>>>>>>>> they perform first an ICA and then a PCA.
>>>>>>>>>>>>
>>>>>>>>>>>> I understand that PCA concentrates the information in less
>>>>>>>>>>>> components (in this case in just one) so its easier to work with the data
>>>>>>>>>>>> (in this case to measure power by frequency bands). However, I think I miss
>>>>>>>>>>>> something about the ICA. My understanding is that ICA separates the signals
>>>>>>>>>>>> to make them independent. If this is the case, can anyone explain why we
>>>>>>>>>>>> would perform first an ICA and then a PCA? Which would be the sense of
>>>>>>>>>>>> separating the signals to concentrate them together again?
>>>>>>>>>>>>
>>>>>>>>>>>> Also, before reading this paper, my intention was to perform an
>>>>>>>>>>>> ICA, average the power for each component in a specific frecuency band and
>>>>>>>>>>>> then average those means for the same frequency. I guess this accumulates a
>>>>>>>>>>>> lot of error, could anyone tell me if this procedure would be valid?
>>>>>>>>>>>>
>>>>>>>>>>>> thanks!
>>>>>>>>>>>>
>>>>>>>>>>>> _______________________________________________
>>>>>>>>>>>> Eeglablist page: http://sccn.ucsd.edu/eeglab/eeglabmail.html
>>>>>>>>>>>> To unsubscribe, send an empty email to
>>>>>>>>>>>> eeglablist-unsubscribe at sccn.ucsd.edu
>>>>>>>>>>>> For digest mode, send an email with the subject "set digest
>>>>>>>>>>>> mime" to eeglablist-request at sccn.ucsd.edu
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> --
>>>>>>>>>>> Makoto Miyakoshi
>>>>>>>>>>> Swartz Center for Computational Neuroscience
>>>>>>>>>>> Institute for Neural Computation, University of California San
>>>>>>>>>>> Diego
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Makoto Miyakoshi
>>>>>>>>> Swartz Center for Computational Neuroscience
>>>>>>>>> Institute for Neural Computation, University of California San
>>>>>>>>> Diego
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Makoto Miyakoshi
>>>>>>> Swartz Center for Computational Neuroscience
>>>>>>> Institute for Neural Computation, University of California San Diego
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Makoto Miyakoshi
>>>>> Swartz Center for Computational Neuroscience
>>>>> Institute for Neural Computation, University of California San Diego
>>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> Makoto Miyakoshi
>>> Swartz Center for Computational Neuroscience
>>> Institute for Neural Computation, University of California San Diego
>>>
>>
>>
>


-- 
Makoto Miyakoshi
Swartz Center for Computational Neuroscience
Institute for Neural Computation, University of California San Diego
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20170121/3caeda18/attachment.html>


More information about the eeglablist mailing list