Atrial fibrillation is an ECG rhythm with a significant mortality due to stroke. The objective of this study was to detect those patients most likely to develop atrial fibrillation, and to identify ECGs closest to the onset of fibrillation. Our hypothesis was that patients with atrial fibrillation would have atrial ectopy, and the frequency of this activity would increase prior to onset of fibrillation. From a learning set of one hundred 30 min ECGs from 50 patients, 25 without atrial fibrillation (normal) and 25 who subsequently developed atrial fibrillation, an algorithm was developed to detect the presence of ectopic beats using R-R interval data. In the learning set, 37150 abnormal and 34/50 normal patients were identified, giving a potential screening accuracy of 71%. As, a prediction test to detect the ECGs closest to atrial fibrillation, 19/25 were correctly identified. For the test set, a total of 29/50 were correctly assigned to the normal and fibrillation groups (reference 20010430.191646 entrant H), and a 39/50 score obtained in predicting the onset of atrial fibrillation (reference 20010430.194799 entrant 11).