## 2 Materials and Methods
### Missing Values Interpolation  
The missing values were then handled with six different interpolation methods:  
Figure 1: Gilbert model simulates burst-error with a two-state Markov chain (i.e., 0 and 1). Figure 2: Examples of 30%, 50% and 70% of missing values created by [PERSON] model. The colored lines refer to missing beats. * No interpolation: this approach does not create interpolated values of missing RR-intervals. Differently to the Deletion method that remove missing values merging non-consecutive beats that induce in missing interpretation of HRV features, the no-interpolation method maintains the missing values into the RR-intervals time series. * Nearest neighbor: the nearest neighbor or proximate interpolation is the easiest interpolation method [12]. This interpolation assigns the value of the closest known (existing) neighbor to the missing- value as shows in Equation (6). \[X_{i}= \begin{cases}x_{B}&\text{if }i<\frac{a+b}{2}\\ x_{A}&\text{if }i\geq\frac{a+b}{2}\end{cases} \] (6) where \(a\) and \(b\) are the indexes of \(x_{A}\) and \(x_{B}\). Interpolated data by this method are discontinuous and it often yields the worst results [13]
* Linear: this method fits a straight line passing through points \(x_{A}\) and \(x_{B}\)[14]. Interpolated data by the linear model are bound between \(x_{A}\) and \(x_{B}\) as showed in Equation (7). \[X_{i}=\frac{x_{A}-x_{B}}{a-b}(i-b)+x_{B}.\] (7) [PERSON] et al. [14] demonstrated that this method is efficient, and most of the time it is better than non-linear interpolations for predicting missing values in environmental phenomena with constant rates. In addition, they also found that in average this interpolation model underestimated the real values but it strongly depends on the distribution of the data. * Quadratic: differently from the linear interpolation model, the quadratic function needs three points of interest to interpolate missing values in a time series as showed in Equation (8). \[X_{i}=x_{B}\frac{(i-b)(x_{C}-x_{A})}{2(b-a)}+\frac{(i-b)^{2}(x_{A}-2x_{B}+x_{C })}{2(b-a)^{2}}.\] (8) Compared to the linear model, quadratic interpolation is found to be in general more accurate [13]. * Spline cubic: fitting datapoints using polynomials of degree higher than one leads to problems of oscillation outside the fitted points, known as Runge's phenomenon [15]. This problem can be avoided by using a spline, a function defined piecewise by polynomials, using datapoints as control points instead of forcing the fitted function to pass through the data points. Cubic spline is a spline composed of piecewise third-order polynomials. By using third degree polynomials is possible to ensure that the resulting curve is smooth [15], avoiding the problem of the straight polynomial interpolation that tends to induce distortions on the edges of the polynomials, given by the fact that, in general, the first and second derivative of the function defined by piecewise polynomials will not be continuous at the edges of polynomials. With cubic spline, it is possible to force the first and second derivatives of consecutive polynomials to be equal, ensuring smoothness of the resulting curve. We applied each of the interpolation methods listed above to heartbeats expressed as a sequence of durations and as a sequence timestamps, then analyzed the error in HRV features estimations, in order to identify the best approach. The on-duration approach is the one mostly used in literature to handle missing values. The data used as input to the interpolation methods was the sequence of durations of the heartbeats (the RR-intervals), obtained by subtracting the timestamp of each heartbeat from the timestamp of the subsequent heartbeat in the sequence of heartbeats. Differently, we propose the the on-time approach whereby interpolation methods are applied to the sequence of timestamps of the heartbeats, postponing the differentiation preprocessing step that transforms timestamps into durations to after the interpolation step.