4.3 Heartbeat dynamics

Download three different time series of heartbeat intervals (HBI) here. If you use R and have package rio installed you can run this code and the load the data into a data.frame directly from Github.

TS1 <- rio::import("https://github.com/FredHasselman/DCS/raw/master/assignmentData/RelativeRoughness/TS1.xlsx", col_names=FALSE)
TS2 <- rio::import("https://github.com/FredHasselman/DCS/raw/master/assignmentData/RelativeRoughness/TS2.xlsx", col_names=FALSE)
TS3 <- rio::import("https://github.com/FredHasselman/DCS/raw/master/assignmentData/RelativeRoughness/TS3.xlsx", col_names=FALSE)

The Excel files did not have any column names, so let’s create them in the data.frame

colnames(TS1) <- "TS1"
colnames(TS2) <- "TS2"
colnames(TS3) <- "TS3"

4.3.1 The recordings

These HBI’s were constructed from the R-R intervals in electrocardiogram (ECG) recordings, as defined in Figure 4.1.

Definition of Heart Beat Periods.

Figure 4.1: Definition of Heart Beat Periods.

  • One HBI series is a sample from a male adult, 62 years old (called Jimmy). Approximately two years before the recording, the subject has had a coronary artery bypass, as advised by his physician following a diagnosis of congestive heart failure. Jimmy used antiarrhythmic medicines at the time of measurement.

  • Another HBI series is a sample from a healthy male adult, 21 years old (called Tommy). This subject never reported any cardiac complaint. Tommy was playing the piano during the recording.

  • A third supposed HBI series is fictitious, and was never recorded from a human subject (let’s call this counterfeit Dummy). Your challenge

The assignment is to scrutinise the data and find out which time series belongs to Jimmy, Tommy, and Dummy respectively.2

4.3.2 First inspection

The chances that you are an experienced cardiologist are slim. We therefore suggest you proceed your detective work as follows:

  • Construct a graphical representation of the time series, and inspect their dynamics visually (use the code examples provided in the solutions to previous sessions to plot your time series).
  • Write down your first guesses about which time series belongs to which subject. Take your time for this visual inspection (i.e., which one looks more like a line than a plane, which one looks more ‘smooth’ than ‘rough’).
  • Next, explore some measures of central tendency and dispersion, etc.
  • Third, compute the Relative Roughness for each time series, use Equation (4.1)
\[\begin{equation} RR = 2\left[1−\frac{\gamma_1(x_i)}{Var(x_i)}\right] \tag{4.1} \end{equation}\]

The numerator in the formula stands for the lag 1 autocovariance of the HBI time series \(x_i\). The denominator stands for the (global) variance of \(x_i\). Most statistics packages can calculate these variances, R and Matlab have built in functions. Alternatively, you can create the formula yourself.

  • Compare your (intuitive) visual inspection with these preliminary dynamic quantifications, and find out where each of the HIB series are positions on the ‘colorful spectrum of noises’ (i.e., line them up with Figure 4.2).
Coloured Noise versus Relative Roughness

Figure 4.2: Coloured Noise versus Relative Roughness

4.3.3 What do we know now, that we didn’t knew before?

Any updates on Jimmy’s, Tommy’s and Dummy’s health? You may start to wonder about the ‘meaning’ of these dynamics, and not find immediate answers.

Don’t worry; we’ll cover the interpretation over the next two weeks in further depth. Let’s focus the dynamics just a little further for now. It might give you some clues.

  • Use the randperm function (in Matlab or in package pracma in R) to randomize the temporal ordering of the HBI series.
  • Visualize the resulting time series to check whether they were randomized successfully
  • Next estimate the Relative Roughness of the randomized series. Did the estimates change compared to your previous outcomes (if so, why)?

  • Now suppose you would repeat what you did the previous, but instead of using shuffle you would integrate the fictitious HBI series (i.e., normalize, then use x=cumsum(x)). You can look up cumsum in R or Matlab’s Help documentation). Would you get an estimate of Relative Roughness that is approximately comparable with what you got in another HBI series? If so, why?

| jump to solution |

  1. The HBI intervals were truncated (not rounded) to a multiple of 10 ms (e.g., an interval of 0.457s is represented as 0.450s), and to 750 data points each. The means and standard deviations among the HBI series are approximately equidistant, which might complicate your challenge.