Fitness HRV

Logo Logo

Release Site for Fitness HRV Applications


12 June 2022

Artifact Corrections

by Stuart Lynne


The fitness_dashboard program captures real-time heart rate data, and specifically the RR interval data. This is used to compute various metrics such as DFA A1 and other HRV statistics such as RMSSD and SNDD.

The collected data contains artifacts due to the nature of the collection process as well as artifacts in the source data. These perturb the metrics by increasing the randomness and the variability of the signal being analyzed.

The 2019 paper from Lipponen and Tarvainen addresses this problem making specific recommendations on finding and dealing with artifacts.

See: A robust algorithm for heart rate variability time series artefact correction using novel beat classification Lipponen

For detection they propose:

a robust automatic method for artefact detection and correction from HRV time series is proposed. Detection of artefacts is based on two variable thresholds. The first threshold is estimated from distribution of successive RR-interval differences and the second one is estimated from distribution of differences between individual RR-intervals and median RR interval.

Correction of artifacts

This is a summary, please refer to the Lipponen paper, section 2.2 Correction of erroneous heartbeats. The paper also provides guidance on correction of erroneous heartbeats:

… the decision algorithm for detecting real artefacts and removing extra detections. Firstly, RR interval is tested against the ectopic beat criterion and secondly against the long or short criterion if beat is classified long or short then missed and extra beat criterions are tested. If criterions are not fulfilled beat is classified as a normal rhythm.

The effect is to remove obviously incorrect data that will would increase variability with data that will have minimal impact on the accuracy of the metrics being calculated from the data.

Decision algorithm

This is a short summary of the decision equations, please refer to the Lipponen paper, section 2 Methods.

Ectopic beat routine

Eq1: S11(j) > 1 and S12(j) < -c1 * S11(j) + c2
Eq1: S11(j) < 1 and S12(j)>< -c1 * S11(j) - c2

Long or Short beat routine

Eq3: sign[ dRR(j)] * dRR(j+1) < -1
Eq4: | mRR(j) | > 3
Eq5: sign[ dRR(j)] * dRR(j+2) < -1

Miss or Extra beat

Eq6: | RR(j) / 2 - medRR(j) | < Th2(j)
Eq6: | RR(j) + RR(J+1) - medRR(j) | < Th2(j)

NN Beattype

This is a summary, please refer to the Lipponen paper, section 2.1 Decision algorithm.

  1. Normal
  2. Ectopic 1 - matched by Equation 1
  3. Ectopic 2 - matched by Equation 2
  4. Missed - matched by Equation 6
  5. Extra - matched by Equation 7
  6. LongShort 1 - matched by Equation 3 or 4
  7. LongShort 2 - matched by Equation 5
  8. Not Checked - insufficient data available

N.B. Not Checked is specified where the algorithm had insufficient information to work on, typically the first and last elements of the RR data collected

Source of Errors

The algorithm cannot differentiate between artifacts generated by the heart or ones induced by the measurement of the data.

In our context, recording fitness related data during strenuous activity, a large number of errors are generated from the movement of the heart rate monitor.