RHRT: Example Pipelines


Determining the HRT class of a person

The main focus of the package is to determine the HRT parameters or class of a person by a long-term ECG measurement. Load the data as a numeric vector and use vectorToHRT to find HRTs, then plot and getResults to check the HRT:

library("RHRT")
hrtl <- vectorToHRT(testdataLong) # create the HRTList
plot(hrtl, main = "Zoomed in Tachogram") # plot the HRTs and check the variability

getResults(hrtl) # get the averaged HRT parameters
## [1] "NR"

The results do not pass the reliability check so we get “NR” instead of an HRT class. The plot shows that firstly TO is near to zero and secondly there is a high variability in the VPCSs. We can go deeper into the data by checking the exact parameters (including TT as an additional hint to the person’s status) and zooming out of the plot:

round(
  getResults(hrtl, "full", TT = TRUE),
digits = 2) # get the parameters and p-values of the variability check
##    TO    TS    TT   pTO   pTS   pTT 
## -0.48 26.82  3.00  0.38  0.00  0.00
plot(hrtl, cropped = FALSE, main = "Full Tachogram") # plot the full VPCSs

As expected TO is not reliable with a p-value over 0.05. The VPCSs still seem to fluctuate a lot. We can can get a picture of the individual TO values by using getHRTParams:

tos <- getHRTParams(hrtl, "TO")
tos
##  [1]  -3.08977601  -2.91673793  -3.86304382 -11.81622053   1.48341915
##  [6]  -2.04437316   2.02537861   6.54482521   0.04640218   1.24190434
## [11]  10.01034320  -3.41808350
summary(tos)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
## -11.816  -3.172  -0.999  -0.483   1.619  10.010
par(mar=c(0, 3, 0, 0))
boxplot(tos)

These results can help to come to a well-founded decision on whether to classify the patient as HRT0/HRTA and trust the TO value or rather classify them conservatively as HRT1/HRTB.

Comparing HRT results with different methodological parameters

This is an example how the package can be used to analyse the HRT methodology. For instance, we can compare the difference in TO and TS values when the order of the calculation steps are switched.

library("RHRT")
hrtl <- vectorToHRT(testdataLong)
getResults(hrtl, type = "parameter", safe = FALSE)
##         TO         TS 
## -0.4829969 26.8151839
hrtl@avHRT <- calcAvHRT(hrtl, orTO = "avBefore", orTS = "avAfter")
getResults(hrtl, type = "parameter", safe = FALSE)
##         TO         TS 
## -0.6618164 35.2097614

Further information can be found in the other vignettes: synopsis, objects & functions and scientific background.