Dear Fieldtripverse,<br>I have been experimenting with using ICA for artifact correction and have the following question:<br>Because
 of the relatively large number of channels vs samples I have, I use the
 option to first reduce the dimensionality of the data with PCA (I have 
248 MEG channels and I select, say 100 components, using the <for 
cfg.method="runica"> cfg.numcomponent=100 and cfg.runica.pca=100 in 
the call to ft_componentanalysis ).<br>
So the "topo" matrix in the component output structure has dimensions 
248x100 and the unmixing matrix has dimensions 100x248. I then use 
something like "data = ft_rejectcomponent(cfg, comp,data)" to say reject
 2 components cfg.component=[30 40] that contain ECG signal. Note: data 
here is the original data I fed in the ft_componentanalysis function.<br>
This is all pretty straightforward and as described in the Fieldtrip 
tutorial (minus the PCA part) . I am however a bit worried by the 
message:"removing 2 components<br>keeping 246 components" I get in the end. Should it not be "removing 2 components<br>
keeping 98 components"? When I look in the code for ft_rejectcomponent, I
 can see that if "hasdata" is True the message is calculated based on 
the number of channels : fprintf('keeping %d components\n',  
nchans-length(cfg.component));<br>
On the other hand (as far as I can tell, not being an ICA expert) the actual calculation for the 
removal of the desired components seems to correctly use the components 
selected for removal :<br>  mixing = comp.topo(selcomp,:);<br>  unmixing = comp.unmixing(:,selcomp);<br>
  tra = eye(length(selcomp)) - mixing(:, cfg.component)*unmixing(cfg.<div id=":8k">component, :);<br>(I do note the comment under that snippet!:<br> %I am not sure about this, but it gives comparable results to the ~hasdata case<br>
  %when comp contains non-orthogonal (=ica) topographies, and contains a complete decomposition)<br>
<br>Further down the function code there are however more operations (eg
 remove unused channels, remove unused components ) where I am less able
 to follow things to make sure it is robust to non-square mixing and 
unmixing matrices. <br>
<br>In summary, I wanted to ask if it is OK to use  ft_rejectcomponent 
in this way (ie without decomposing to the full number of ICA's and then
 using it on the original data).<br>With Thanks and Best Wishes,<br>Haris<br>
<br>Charidimos [Haris] Tzagarakis MD, PhD, MRCPsych
<br>University of Minnesota Dept of Neuroscience and Brain Sciences Center
</div>