Applies linear interpolation to correct identified artifacts in RR intervals. This method provides the lowest RMSSD bias according to research and is particularly effective for single-beat artifacts.
correct_rr_linear(rr_intervals, artifact_indices, preserve_boundaries = TRUE)Numeric vector of corrected RR intervals with same length as input
This function implements enhanced linear interpolation following research recommendations:
Uses the 20% rule for artifact detection when artifact_indices not provided
Handles single beats differently from longer gaps (>3 beats)
Preserves segment boundaries to maintain physiological variability
For edge artifacts, uses nearest valid value rather than extrapolation
Linear interpolation has been shown to produce the lowest RMSSD bias among correction methods, making it ideal for HRV analysis.
Research shows linear interpolation provides lowest RMSSD bias for artifact correction in HRV analysis.
if (FALSE) { # \dontrun{
rr_data <- c(800, 850, 400, 830, 810) # 400 is an artifact
corrected <- correct_rr_linear(rr_data, artifact_indices = 3)
} # }