function [indEliminated]=thresholding(numKept, percentageNeg, lambdaF)

  nNegSelected=ceil(numKept* percentageNeg);
  nPosSelected=numKept-nNegSelected;
  sp=sort(lambdaF(:),'descend');
          
  nPos=length(find(sp>0));
  nNeg=length(find(sp<0));   
          
  nNegSelected = min(nNegSelected, nNeg);
  nPosSelected = min(nPosSelected, nPos);
          
  thrpos= sp(nPosSelected);           
  thrneg= sp(end-nNegSelected+1);
          
  indEliminated=find(lambdaF<thrpos & lambdaF>thrneg);