Linear Decomposition Terminology
After decomposing the data, (by runica() / binica(), or by any other linear decomposition method), the unmixing matrix is
W = weights*sphere;The component time courses are the rows of the activations matrix
activations = W*data;The activations are the time courses of activation of each of the components.
The component scalp maps are the columns of the mixing matrix (the inverse of the unmixing matrix W)winv = inv(W);Thus, each independent component (here, each infomax component) consists of a time course (activation matrix row time series) and a scalp map (inverse weight matrix column).
Note: if the number of components output by ICA (using the 'pca' option of runica() or binica()) is less than the number of data channels, the component maps should be the columns of the pseudo-inverse weight matrix.
winv = pinv(W);Finally, the back projection of component n onto the original data is
n = 4; projection = winv(:,n)*activations(n,:); % n'th map times n'th activationThe projection of a component is in the original data space, i.e. in the same channels (e.g., Fz, Cz, etc.) and units (e.g., uV) as the original data. Since ICA is a linear decomposition, the projection of a sum of components is the same as the sum of the projections of the individual components.
Thus, it is incorrect to say that ICA loses scaling information. Rather, it distributes this information between the weights (or winv) and activations matrices. It all comes back together again when you multiply these together to get the component back projections.
Note: The same linear decomposition equations and interpretations apply equally well to any linear decomposition -- for example, one found using PCA, Varimax, Quartimax, Promax, other ICA algorithms such as JADE, or etc. -- and all the toolbox visualization and plotting functions are equally useful for visualizing their associated component time courses, scalp maps and back projections. The mypca() help message gives the correspondence between standard the PCA and ICA terminologies.
Visualizing the Decomposition
To select components for further analysis, we need to visualize the ICA component maps and time courses. Using envtopo() we plot the projections plus the scalp maps of four ICA components in the first data epoch. Function envtopo() superimposes the envelopes of the component projections on the envelope of the data. (Definition: The envelope of a multi-channel data set consists of two time series giving its most positive and most negative channel values at each time point). Oblique lines from the maps point to the time point of maximum component amplitude in the plotted data epoch.
Electrode locations are specified in the ascii "chan_locs" (channel locations) file here named 'eloc.loc'. To create a channel locations file from 3-D electrode locations specified in Cartesian [x y z] coordinates, try cart2topo(). Else, if you have electrode locations in 3-D spherical coordinates (2 angles plus radius), try sph2topo(). These work with some manufacturer's electrode locations, but are not guaranteed to work with all. (Please send us results of your efforts in this area, so we can share them with others.)
Plots produced by envtopo() may appear complicated - but they efficiently display a large amount of information about the decomposition of a short data epoch. They are useful for determining automatically the components making the largest contributions to a data epoch and the relative strength, timing and polarities of their contributions. Note: specifying a component number vector of 0 will make envtopo() plot the envelopes and maps of the 6 components (individually) accounting for most variance in the data.
% envtopo(data,weights,'chan_locs',[limits],[compnums],... figure; envtopo(data(:,1:floor(0.6*frames)),W,'eloc.loc',... [0 995*0.6 0 0],[2 3 4 6],'Largest Components');![]()
Alternatively, we may use projtopo() plot the first data epoch at each channel (black traces below) along with the projections of several independent components (colored traces).
% [projectdata] = projtopo(data,weights,compnums,chanlocs,... % title,limits,chanlist,channames,colors); figure; projtopo(matsel(data,frames,0,0,1),W,1:10,... 'eloc.loc','First epoch',limits,[1:10],'chan.nam');![]()
Given a size specifier (example: [3 5]), projtopo() will plot the channels in rectangular array order. Note: Use topoimage() to plot a channel-by-channel set of two-dimensional images, such as time/frequency plots produced by timef() or crossf() or sorted single trials visualized by erpimage(), in topographic order.
Alternatively, we can use plotproj() to plot the same data plus projections:
% [projectdata] = plotproj(data,weights*sphere,compnums,... % title,limits,chanlist,channames,colors); figure; plotproj(matsel(data,frames,0,0,1),W,1:10, ... 'First epoch (comps. 1-10)',limits,[1:10],'chan.nam');![]()
Next, we plot the interpolated scalp maps of four of the components using compmap(). Function compmap() calls topoplot() to make each scalp map. Note: specifying the (default) component index of '0' makes compmap() plot all the component maps; negative component numbers are plotted with reverse polarity; zeroes in the component index vector create blank spaces in the plot.
% compmap (winv,'chan_file',index,title,pagesize,labels,printflag) figure; compmap(maxmap,'eloc.loc',1:4,'Maps of 1st 4 ICA Components',... [2 2],[4 8 11 7]);![]()
Or, we can simply plot the activations of all 14 independent components using plotdata().
% plotdata(data,frames,limits,title,channames,colors,rtitle,ydir); figure; plotdata(activations,frames,0,'ICA Component Activations',... 'chan.nam',0,'(2 conditions)');![]()
Finally, we use compplot() to display the projection, at all data channels in the second data epoch, of one ICA component (5), adding a scalp map of its maximum projection in the epoch. Note: the icademo() script also illustrates use of an animated version of this plot created and viewed by functions eegmovie() and seemovie().
% compplot(data,plotframe,chan_file,xstart,srate,title); projectdata = icaproj(matsel(data,frames,0,0,2),W,5); figure; compplot(projectdata,145,'eloc.loc',0,srate,'ICA Button Press Component');![]()
Tools for analyzing sets of single trials...
Open the function help window
View log of changes to this tutori al.
Comments and suggestions on this tutorial
are welcome. Email scott@salk.edu