Next: NST(1) Up: WFDB Applications Guide Previous: MXM(1)On This Page


nguess - guess the times of missing normal beats in an annotation file


nguess -r record -a input-annotator [ options ... ]


This program copies its input (a WFDB annotation file containing beat annotations), removing annotations of events other than sinus beats, and interpolating additional Q (unknown beat) annotations at times when sinus beats are expected. Intervals between sinus beats are predicted using a predictor array as described by Paul Schluter ("The design and evaluation of a bedside cardiac arrhythmia monitor"; Ph.D. thesis, MIT Dept. of Electrical Engineering, 1981). When the predictions are inconsistent with the known sinus beats, as may occur in extreme noise or in highly irregular rhythms such as atrial fibrillation, no interpolations are made.

Options for nguess include:

-f time
Begin at the specified time. By default, nguess starts at the beginning of the record.
Print a usage summary.
-m M
Insert Q annotations in the output at the inferred locations of sinus beats only when the input RR interval exceeds M times the predicted RR interval (default: M = 1.75). M must be greater than 1; its useful range is roughly 1.5 to 2.
-o output-annotator
Write output to the annotation file specified by output-annotator (default: nguess).
-t time
Stop at the specified time.

It should be understood that, as the name of this program implies, the Q labels it generates represent, at best, good guesses about the times at which sinus beats may be expected. Ideally, one should avoid having to make such guesses, but some commonly-used techniques for study of heart rate variability (for example, conventional methods for power spectral density estimation in the frequency domain) require a uniformly sampled instantaneous heart rate signal, such as can be obtained using tach(1) to process the output of nguess. Other techniques, such as the Lomb periodogram method implemented by lomb(1) , can obtain frequency spectra from time series with missing and irregularly spaced values, such as can be produced from a beat annotation file using ihr(1) without the need to use nguess. Use nguess only when necessary and do not expect it to perform miracles; as a rule of thumb, if the number of guesses (Q annotations) exceeds one or two percent of the number of known sinus beats (N annotations), be exceedingly wary of the guesses and consider using techniques such as lomb(1) that do not require the use of nguess. Also as a general rule, nguess works best when it is guessing the locations of sinus beats obscured by noise, or those of sinus beats that were inhibited by isolated premature ventricular beats; the underlying hypothesis of a quasi-continuous sinus rhythm, the basis not only of nguess but also of all other algorithms for reconstructing NN interval time series, is most suspect in the context of supraventricular ectopic beats (which may reset the SA node, thus interrupting the sinus rhythm) and consecutive ventricular ectopic beats.

The predictor array method is based on the observation that most of the short-term variability in normal sinus inter-beat (NN) intervals is due to respiratory sinus arrhythmia (RSA, the quasi-periodic modulation of heart rate by respiration, which is most notable in young, healthy subjects and decreases with age). Since respiration rate is (in humans and smaller mammals) substantially slower than heart rate, it is possible to estimate the length of the respiratory cycle in terms of some number of NN intervals. If, for example, heart rate is around 60 beats per minute and respiration rate is around 10 breaths per minute, one might expect that 6 NN intervals would correspond to one breath, and that the current interval might be particularly well-approximated by the sixth previous interval. Since we don’t know the ratio between heart and respiration rate a priori, we can observe how well each of the previous PBLEN (a constant defined in nguess.c, see below) intervals predicts the current interval on average. Thus we have PBLEN predictors for each interval, some of which may be much better on average than others. At any time, we know which predictor is (locally) the best, and we can use that predictor to make a best guess of the location of the next sinus beat. In subjects with significant RSA, the best predictor may be determined by the length of the respiratory cycle; in others, the previous beat may be a better predictor. For our purposes, it really doesn’t matter which predictor is best, only that the mean error of the best predictor is small. If the next known sinus beat is at least 1.75 times as distant as the prediction, and if the predictions are reasonably good on average, ’nguess’ asserts that a gap exists and fills it in with a Q annotation (or more than one, if the gap is sufficiently long).


It may be necessary to set and export the shell variable WFDB (see setwfdb(1) ).


header file
input annotation file (may contain any annotations)
output annotation file (contains N and Q annotations only)

See Also

ihr(1) , lomb(1) , setwfdb(1) , tach(1)


George B. Moody (


Table of Contents

Up: WFDB Applications Guide

Please e-mail your comments and suggestions to, or post them to:

MIT Room E25-505A
77 Massachusetts Avenue
Cambridge, MA 02139 USA

Updated 28 May 2015