ibi_qa: Conduct basic QA checks on IBI time series of ecg signal.

View source: R/ecg_qa.R

ibi_qaR Documentation

Conduct basic QA checks on IBI time series of ecg signal.

Description

After converting importing acq file into the experiment.pipeline structure, this function converts the ECG signal to an IBI ts and conducts basic QA checks on the IBI ts.

Usage

ibi_qa(
  ecg_ts,
  time_ts,
  Hz = 1000,
  outlier_arg =
    "ibi_diff >  upper_quartile_ibi_diff + 2*iqr_ibi_diff | ibi_diff < lower_quartile_ibi_diff - 2*iqr_ibi_diff",
  time_bin = 100
)

Arguments

ecg_ts

a vector containing the ECG signal. In experiment.pipeline objects, this vector can be found under <acq_data>$raw$<ecg signal name>

time_ts

a vector containing the time corresponding to the ECG signal. In experiment.pipeline objects, this vector can be found under <acq_data>$raw$<time series name>

Hz

the sampling rate (in Hz) of the raw ECG signal. Defaults to 1000 Hz

outlier_arg

the argument for how outliers are defined. Defaults to 2*IQR above and below the 25th and 75th percentiles of ibi differences.

time_bin

for the list of plots, how many seconds of ecg signal should be presented per plot. Default is 100 seconds

Details

This function uses the detect_rpeaks function from rsleep to create an interbeat interval time series of the ECG signal. Future versions of this function will likely additionally integrate wfdb as a QRS detection method. This function then converts the IBI ts into a HRV data set using RHRV. By converting the IBI ts into RHRV, we then interpolate the IBI ts onto a time grid. Finally, this funciton employs the tidyverse package to wrangle that data and provide basic QA and automatizes outlier checks. By default, outliers are defined as 2IQRs above the 75th percentile of IBI differences or below the 25th percentile. Alternative outlier definitons can be provided as an argument into the function. Part of these outlier checks include provide plots of the ecg signal where it is believed there is to be an outleir. For the purpose verifying these QA checks (i.e., to ascertain if there's a problem with the QRS detection algorithm), this function also returnes the IBI time series plotted over the ecg signal as both as a single plot (for the entire time series) and as a list of plots binned by time_bin increments (default is 100s). N.B. For long time series, this total plot will be less useful and it is recommend to interrogate the plot list obejct instead.

Author(s)

Alison Schreiber


PennStateDEPENdLab/experiment.pipeline documentation built on March 29, 2024, 4:31 a.m.