<div dir="ltr"><div dir="ltr">Dear all,<div><br></div><div>I would like to avoid the issues associated with data rank when running AMICA.</div><div>I know that interpolating bad channels and average re-referencing are common operations that could make the data rank deficient. I also know that the Matlab 'rank' function is not always reliable. </div><div>I am asking whether the following approach is correct.</div><div><br></div><div>After interpolating bad channels and re-referencing to the average, I estimate data rank by using the following snippet of code:</div><div><br></div><div><div>% Estimating data rank</div><div>dataRank = EEG.nbchan;</div><div>if strcmp(EEG.ref,'averef')</div><div>    dataRank = dataRank - 1;</div><div>end</div><div>if isfield(EEG.etc,'clean_channel_mask') % using ASR to remove bad channels</div><div>    dataRank = dataRank - length(find(~EEG.etc.clean_channel_mask));</div><div>end</div><div>dataRank = min([rank(double(EEG.data')) dataRank]);</div></div><div><br></div><div>Next, I enter dataRank in the field named '# PCA Dims' of the pop_runamica() window. In this way, I get exactly dataRank independent components, keeping all the channels (remember that this step occurs after channel interpolation).</div><div><br></div><div>Is this approach correct?</div><div>Thank you in advance.</div><div><br></div><div>All the best,</div><div>Thomas</div></div></div>