function pdlist = predictions(data,n,rank,missindex)

initpoint = 21;
pdlist = [];

for i=initpoint:n:length(data)-n               %run the detector starting with approximately half the points
  if ~isempty(missindex) & i == missindex(mi)     
        mi = min(length(missindex(:,1)),mi + 1);
        i = i+missindex(mi,ah)-missindex(mi,1);
  else
  %  'Calculate model'
    model = newmodel(data,i,0.005);%DCTthresholdSelection(data,i-n,n,'n');
    % boundary = findboundary(model,data(1:length(model)),'n'); %boundary is at 3sigma
%'Make Prediction'
    P = arpred(model,n,rank);%PredictionwithWavelets(model,n);   %make predictions for the components
    pdlist = [pdlist;data(i+1:i+n) P(i+1:i+n)];
  end;
end;