Comparing Decompositions
Matching Component Maps
Suppose you have two linear decompositions (ICA or other) which you want to compare. First, does this mean you want to compare their scalp maps, their time courses, or both? Often, comparing their maps is of primary interest, since the time courses are not expected to be similar. To perform this comparison is difficult because best-matching component pairs may not have the same component ranks or polarities. The toolbox provides a function to solve this: matcorr(),
% [rs,ix,iy,corrs] = matcorr(x,y,...); % Operates on rows of matrices x, y [rs,i1,i2] = matcorr(winv1',winv2');Above, we pair maps from two ICA decompositions whose scalp maps are stored in matrices winv1 and winv2. Because matcorr() operates on rows, we must transpose them using the prime operator in the function call. The default matching method is used here, the Hungarian Method. This maximizes the sum of the absolute correlations between members of the output pairs (two other matcorr() options). The results of matcorr() are stored in three output variables. Column vector rs contains the (signed) correlations of the matching pairs, listed in descending order of absolute correlation. Column vectors [i1, i2] give the indices in winv1 and winv2 of each pair. Thus, [rs i1 i2] conveniently summarizes the matches:
[rs i1 i2] 0.999814 1 1 <== best correlated -0.998903 2 2 0.997495 10 8 -0.997252 4 3 -0.995898 5 10 0.995418 6 4 0.994001 8 5 0.992133 7 6 -0.983395 18 18 0.98325 11 14 0.982962 14 15 0.982036 21 25 -0.979888 3 7 0.978159 9 13 0.975483 12 11 -0.972997 26 22 <== median (anti)correlated 0.959895 16 20 0.948243 27 26 -0.928847 15 24 0.909665 20 16 -0.907484 24 19 0.880436 17 9 0.874974 13 12 0.820293 29 31 -0.757431 25 17 -0.735049 22 21 0.648853 23 30 -0.517851 30 27 0.432097 31 23 0.311148 19 28 0.194275 28 29 <== worst correlated
![]()
The upper right panel above shows the absolute correlations (abs(rs)) between best-matching pairs of scalp maps for components from two decompositions of 25 grand mean ERPs. About 20 of the 31 components match with absolute map correlations above 0.90. The left panel shows the three matched pairs of component maps (marked in the right panel) with highest, median, and lowest absolute map correlations. This figure was made by:
figure; sbplot(2,3,3); % Define axes in top right 1/3 of figure set(gca,'linewidth',2,'fontweight','bold') % Use thick lines for web plot(1:31,abs(rs),'r-','linewidth',2); hold on; % Plot line xlabel('Comp. Pairs');ylabel('Abs. Corrrelations');% Plot circles selpairs = [1 16 31]; % Selected map pairs (first, median, last) plot(selpairs,abs(rs(selpairs)),'bo','linewidth',2); % Mark selected circles axis([0 32 0 1.2]); sbplot(2,3,6); % Define axes in bottom right 1/3 of figure set(gca,'linewidth',2,'fontweight','bold') plot(i1,i2,'linewidth',2);xlabel('winv1 component');ylabel('winv2 component'); axis([0 32 0 32]); % Plot i1 vs i2 winvs = [winv1 winv2]; % The 2x31 maps is = [i1 i2+31]; % Indices to columns of winvs sel_is = reshape(is(selpairs,:)',1,6); % Reshape into a vector % compmap(winv,'eloc_file',compnos,'title',rowscols,labels,...); sbplot(1,3,[1 2]); axis off; set(gca,'linewidth',2,'fontweight','bold') % Use thick lines for web compmap(winvs,'eloc_locs',sel_is,'Marked Component Pairs',[3 2],rem(sel_is,31));The lower right panel above plots the paired component indices i1 and i2. Note that lower component numbers are generally paired. In fact, these two decompositions were of the same data, one using 'extended Infomax' and one 'un-extended' i.e. logistic Infomax.
Reorder components
Once you have run matcorr() on two sets of component maps, you can use matperm() to reorder one of them to match the other:
% [xnew ixy] = matperm(x,y,ix,iy,corrs); [make21 i21] = matperm(winv2',winv1',i2,i1,rs); make21 = make21';Perform time/frequency analysis on data channels or components ...
Open the function help window
Comments and suggestions welcome. scott@salk.edu
View log of changes to this tutorial.