% keywords
% Instrumentation and measurement, Measurement, Biomedical monitoring
% Instrumentation and measurement, Measurement, Biomedical monitoring, Photoplethysmography
% Sensors, Wearable sensors
% Sensors, Multimodal sensors
% Signal processing, Noise, Signal to noise ratio
% Sensors, Sensor phenomena and characterization
% Signal processing, Error correction
% Signal processing, Noise, Noise cancellation
% Signal processing, Digital signal processing
% Signal processing, Spectrogram



%%%%%%%%%%%%%%%%%%%%%%% file template.tex %%%%%%%%%%%%%%%%%%%%%%%%%
%
% This is a general template file for the LaTeX package SVJour3
% for Springer journals.          Springer Heidelberg 2010/09/16
%
% Copy it to a new file with a new name and use it as the basis
% for your article. Delete % signs as needed.
%
% This template includes a few options for different layouts and
% content for various journals. Please consult a previous issue of
% your journal as needed.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% First comes an example EPS file -- just ignore it and
% proceed on the \documentclass line
% your LaTeX will extract the file if required
%\begin{filecontents*}{example.eps}
%!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: 19 19 221 221
%%CreationDate: Mon Sep 29 1997
%%Creator: programmed by hand (JK)
%%EndComments
%gsave
%newpath
%  20 20 moveto
%  20 220 lineto
%  220 220 lineto
%  220 20 lineto
%closepath
%2 setlinewidth
%gsave
%  .4 setgray fill
%grestore
%stroke
%grestore
%\end{filecontents*}
%
%\RequirePackage{fix-cm}
%
%\documentclass{svjour3}                     % onecolumn (standard format)
%\documentclass[smallcondensed]{svjour3}     % onecolumn (ditto)
%\documentclass[smallextended]{svjour3}       % onecolumn (second format)
%\documentclass[twocolumn]{svjour3}          % twocolumn
%
%\smartqed  % flush right qed marks, e.g. at end of proof
%

\documentclass[twocolumn]{htl-author}

\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage{amsmath}
%\interdisplaylinepenalty=2500
\usepackage{caption}
\usepackage{cite}

%
% \usepackage{mathptmx}      % use Times fonts if available on your TeX system
%
% insert here the call for the packages your document requires
%\usepackage{latexsym}
% etc.
%
% please place your own definitions here and don't use \def but
% \newcommand{}{}
%
% Insert the name of "your journal" with
% \journalname{myjournal}
%
\begin{document}

\title{Profiling the Propagation of Error from PPG to HRV Features in a Wearable Physiological-Monitoring Device}

%\subtitle{Do you have a subtitle?\\ If so, write it here}

%\titlerunning{Short form of title}        % if too long for running head

\author{Davide Morelli$^{1,2,3}$, Leonardo Bartoloni$^{1,2}$, Michele Colombo$^{1,2}$, David Plans$^{1,3}$, and David A. Clifton$^{4}$}


%\authorrunning{Morelli et al.} % if too long for running head
%
\address{$^1$ BioBeats Group Ltd., London, UK \\
$^2$ Dipartimento di Informatica, Universit\`a di Pisa, Italy \\
$^3$ Center for Digital Economy, University of Surrey, UK \\
$^4$ Department of Engineering Science, University of Oxford, UK}

% old intro to abstract:
% Wearable physiological monitors are becoming increasingly commonplace in the consumer domain, but few systems have penetrated into use within healthcare systems. One contribution to this lack of use in clinical practice is the performance of consumer devices when measuring the physiology of ambulatory patients.  There is consequently a need to characterise the use of such systems in ambulatory settings, where there exist no substantive studies in the literature.

\abstract{Wearable physiological monitors are becoming increasingly commonplace in the consumer domain, but in literature there exists no substantive studies of their performance when measuring the physiology of ambulatory patients. In this paper, we investigate the reliability of the heart-rate sensor in an exemplar ``wearable" wrist-worn monitoring system (the Microsoft \emph{Band 2}); our experiments quantify the propagation of error from (i) the photoplethysmogram (PPG) acquired by pulse oximetry, to (ii) estimation of heart rate (HR), and (iii) subsequent calculation of heart rate variability (HRV) features. Our experiments confirm that motion artefacts account for the majority of this error, and show that the unreliable portions of heart rate data can be removed, using the accelerometer sensor from the wearable device.  Our experiments further show that acquired signals contain noise with substantial energy in the high-frequency band, and that this contributes to subsequent variability in standard HRV features often used in clinical practice.  We finally show that the conventional use of long-duration windows of data is not needed to perform accurate estimation of time-domain HRV features.}

\maketitle

%\begin{IEEEkeywords}
%Biomedical monitoring, Photoplethysmography, Wearable sensors, Signal to noise ratio, Error correction.
%\end{IEEEkeywords}

%\keywords{Data Accuracy \and Error Propagation \and Wearable device \and Heart Rate Variability \and PPG}
% \PACS{PACS code1 \and PACS code2 \and more}
% \subclass{MSC code1 \and MSC code2 \and more}

\section{Introduction}
\label{intro}

Wearable physiological monitoring, exploiting devices with unobtrusive (often wrist-worn) packages, offers substantial promise for improving the care of patients in clinical settings, and for enabling individuals to better manage their own health.  With recent advances in consumer markets, including devices such as fitness trackers and ``smart watches'', the use of wearable monitors is becoming increasingly commonplace.  However, very few of these devices penetrate into use at scale within either clinical settings or for permitting patients to track their own health outside clinical environments \cite{Clifford2012,Tarassenko2011}, with only small numbers of studies that have been described in the literature \cite{Shah2017,Clifton2015c,schafer2013accurate}.  A major obstacle to the use of wearable devices in such settings is the lack of characterisation of their ability to estimate clinically-relevant physiological parameters, such as, in the case of cardiac applications, understanding the propagation of error from the PPG waveform acquired within the device, through to estimation of the HR, and ultimately on to the HRV features that are used to track the state of cardiac health of a patient.

In this paper, we investigate this propagation of error, with the aim of improving understanding of the accuracy of the estimated HRV features; we use as our experimental device a commonly-used wearable consumer device, the Microsoft \emph{Band 2}.  The most commonly-occurring mode of error in such wearable devices has previously been identified as being due to movement artefact \cite{Orphanidou2015}, which is unsurprising given the sensitivity of the pulse oximetry process (which yields the PPG waveform from which HR and HRV parameters are estimated) to the small changes in light intensity that arise due to movement of the patient. However, while some studies have investigated how to mitigate the effects of motion artefacts correcting the raw PPG signal \cite{han2007development,lee2003reduction,han2012artifacts}, we could find a small amount of studies investigating the possibility to assess PPG reliability from accelerometer \cite{lee2013comparison}, and no study investigating the propagation of error from PPG to HRV features.

This investigation provides the following contributions: (i) investigation of a means of discriminating when the time-series of pulsatile intervals (estimated from the PPG) should be discarded; (ii) estimate the expected error on subsequently-derived HRV features as movement of the patient increases; and (iii) suggest a means of filtering to minimise the error of the HRV features.


\subsection{\label{sec:HRVdefs}Heart-Rate Variability}

HRV is the beat-to beat variability in R-R intervals (sometimes termed \emph{NN intervals} or \emph{successive differences} in the literature), where the latter refers to the time-series obtained by identifying the duration between subsequent R-peaks in the ECG waveform.  An R-R interval $t$ therefore corresponds to an estimate of instantaneous heart rate $60 t^{-1}$ bpm (beats per minute).  HRV features are descriptors that capture aspect of this variability in the time- or frequency-domain.  Examples of the former include the following, which are defined for a window of data of duration $\tau$, where often $\tau = 5$ minutes:

\begin{itemize}
\item AverageNN, defined as being the mean of the NN intervals occurring within the window \cite{stein1997differing,schafer2013accurate};

\item SDNN, defined as being the standard deviation of the NN intervals occurring within the window \cite{Berntson1997,jeyhani_comparison_2015,stein1997differing,schafer2013accurate};

\item RMSSD, the root-mean-square (RMS) of successive differences (SD) occurring within the window \cite{jeyhani_comparison_2015,stein1997differing,schafer2013accurate}; and

\item pNN50, which is the proportion of the total number of NN intervals within the window, that exceed 50 ms.  That is, one first defines \{NN50\} as being that subset of \{NN intervals\} that exceed a duration of 50 ms, and where pNN50 is $|$NN50$|\ /\ |$NN intervals$|$, where $|\cdot|$ is set cardinality \cite{jeyhani_comparison_2015,stein1997differing,schafer2013accurate}.

\end{itemize}

Examples of frequency-domain HRV features include:

\begin{itemize}
\item SVI, which is the \emph{sympathovagal index}, defined as the LF:HF ratio, where LF is the total power in the low-frequency band (between 0.003 and 0.14 Hz), and where HF is the total power in the high-frequency band (between 0.15 and 0.40 Hz).  The definition of the boundaries of the LF and HF bands varies slightly between authors, being a heuristic definition \cite{Pomeranz1985,Berntson1997,stein1997differing}.
\end{itemize}

For simplicity we use the same name for HRV features calculated from R-R intervals (collected from the ECG sensor), and the HRV features estimated from P-P intervals (collected from the PPG sensor).

HRV analysis is traditionally carried out via ECG collected in a controlled environment; analysis thereby proceeds on the assumption of noise-free data.  Many HRV features aim to capture fast variability (high frequencies) in R-R time-series, which is easily and adversely affected by the presence of outliers.  For this reason, the time-series of RR intervals is typically reviewed manually, before their use in analysis.

The use of PPG instead of ECG for HRV analysis is not extensively explored, and especially for those cases in which the PPG is acquired via consumer-grade wearable devices.  Various studies have explored the accuracy of HRV features extracted from clinically-graded PPG devices   \cite{bolanos_comparison_2006,jeyhani_comparison_2015,lin_comparison_2014,lu_comparison_2009,russoniello_measurement_2010,selvaraj_assessment_2008,teng_study_2003}, while analysis of the quality of HRV from a PPG acquired from smartphones has been described \cite{peng_extraction_2015}.  These studies have, in general, concluded that HRV analysis from PPG acquired under carefully-controlled conditions is reliable, because most HRV features estimated via PPG show a very high correlation with the same features estimated via ECG.  A notable exception to the latter exists for pNN50 \cite{jeyhani_comparison_2015,lu_comparison_2009}, which was shown to be less reliable when estimated via the PPG than from the ECG.

It has been reported that use of the PPG is only reliable if the cardiovascular system is in a stationary condition \cite{teng_study_2003}; i.e., that the PPG cannot reliably be used using conventional methods when the subject is recovering from physical activity.  In our experiment, we investigate this finding (and ultimately find no difference in accuracy after a short period of exercise than when compared with PPG from a resting condition).  We here describe our investigation of the accuracy of HRV features estimated from a wrist-worn PPG sensor in a \emph{non-controlled} environment, as would be represented by a typical setting for the use of wearable devices.  This is a crucial preliminary task in HRV analysis from wearable devices, and, to our knowledge, no study has yet been carried out on this subject.

To our knowledge this is the first analysis of the error propagation from P-P intervals to HRV features.

\section{Experimental Design}

The trial from which data was derived for use in this manuscript was reviewed by and received a favourable ethical opinion from University of Surrey Ethics Committee, with reference number UEC/2016/027/FASS.

We collected 30 minutes of data from the wearable device for each of 5 subjects, all male, healthy, Fitzpatrick scale Type III, mean age 32 (standard deviation 6).  These data include (i) a time-series of the accelerometry for each of three orthogonal axes of motion and (ii) a time-series of pulse-to-pulse intervals, both of which are estimated by the band from its PPG sensor.  We concurrently collected \mbox{R-R} intervals using an ECG sensor (acting as the gold standard) from a \emph{Polar H7} chest-mounted strap. We will hereafter use the term \emph{\mbox{P-P intervals}} to refer to both the pulse-to-pulse intervals (acquired from the wrist-worn wearable PPG device), and \emph{\mbox{R-R intervals}} to refer to beat-to-beat intervals (acquired from the chest-mounted ECG system).

Our experimental protocol comprises four sections:
\begin{enumerate}
\item For $t = [0\ 300]$ s, the subject was requested to sit as still as possible, refraining from talking or moving the arm on which the wearable PPG system was mounted.  This first section of the experiment is aimed at establishing a reliable baseline for both motion artefacts and resting heart rate.
\item For $t = [300\ 600]$ s, the subject was requested to climb and then descend two storeys of stairs without stopping.  This second section is aimed at measuring the error induced by motion artefacts, and to raise substantially the heart rate of the subject.
\item For $t = [600\ 1200]$ s, the subject was again requested to sit as still as possible. The aim of this third section is to establish the propagation of error from a PPG sensor, in absence of movement, when the subject is not in a stationary cardiac situation.
\item For $t = [1200\ 1800]$ s, the subject is requested to remain sitting, but is permitted to perform normal seated activities; e.g., talking, using a laptop computer, etc.
\end{enumerate}

\section{Methods}

This section describes the steps taken in analysing the data acquired from each subject.  Aggregated results for all subjects will be presented later, in section \ref{sec:all_users}.

\subsection{Accelerometry}
From the three time-series of accelerometry $x_t$, $y_t$, $z_t$, corresponding to motions in each of three orthogonal directions, we consider absolute magnitude of the first-order differences, which is therefore invariant to rotation of the device:
\begin{equation}
\label{eq:MagnitudesDerivative}
w_t = \sqrt{(x_t-x_{t-1})^2 + (y_t-y_{t-1})^2 + (z_t-z_{t-1})^2}
\end{equation}
which are subsequently averaged over a window of duration $\tau$, containing $n$ samples,
\begin{equation}
\label{eq:MagnitudesDerivativeWindow}
W_t(n) = \frac{1}{n} \sum_{i=t-n}^{t} w_i
\end{equation}

The time-series $w_t$ is shown for an exemplar subject in figure~\ref{fig:RR_Acc}.  It may be seen from the figure that the accelerometry time-series increases with the activity undertaken during the second phase of the experiment (in which the subject was climbing and descending stairs), and that there was very little activity during the first and third sections (during which the subject remained still).  The ``free-action'' fourth section shows little activity, with occasional transients in activity, arising from rapid and infrequent movements of the wrist on which the device was worn.

The figure also shows that there exist the expected differences between P-P and R-R intervals estimated from the PPG and ECG sensors. During the first and third sections, the time-series of P-P and R-R intervals are similar. As motion increases, it may be seen that the fourth section corresponds to frequent substantive differences between P-P and R-R intervals, and that these differences become larger during the increased activity of the second section.

\begin{figure}
\includegraphics[width=0.48\textwidth]{InternalNoiseWhitePaper-003}
\caption{\label{fig:RR_Acc} Time-series of P-P and R-R intervals acquired from PPG and ECG (upper plot), and corresponding accelerometry time-series $w_t$ (lower plot) for an exemplar patient, where divisions between the four sections of the experimental protocol are shown as vertical dashed lines.}
\end{figure}

\subsection{Outlier Removal}

Before subsequent processing, we performed outlier removal to discard P-P intervals with physiologically-implausible values; e.g. increased P-P intervals (and therefore HR) that occur faster than could be feasibly produced by physiology.  This was straightforwardly performed by computing a 10 s moving average $\mu_{10}$, and then discarding P-P intervals $PP_t$ for which $|PP_t - \mu_{10}| \geq 0.5\mu_{10}$.  Figure~\ref{fig:OutlierRemoval} shows this pre-processing step applied to the R-R intervals obtained from the PPG, where it may be seen that the largest transients are removed.

\begin{figure}
\includegraphics[width=0.48\textwidth]{InternalNoiseWhitePaper-004}
\caption{\label{fig:OutlierRemoval} P-P intervals selected for removal (vertical red lines), and corresponding distance of instantaneous P-P interval from the 10 seconds moving average, as a percentage. The blue horizontal dotted line indicates the threshold for the distance to trigger an outlier detection.}
\end{figure}

%\begin{figure}
%\includegraphics[width=\textwidth]{InternalNoiseWhitePaper-005}
%\caption{I would advise moving this figure to be the lower plot of the preceding figure, such that we have a ``before'' and ``after'' figure.  This would thereby remove the "PPG distance from the mean PPG" lower plot of the preceding figure which, while interesting, is probably not needed given the straightforward nature of the pre-processing step.  Note that both ``before'' and ``after'' subplots in the new combined figure should have the same y-axis scaling.}
%\end{figure}

\subsection{HRV Analysis}

We estimate the various HRV features defined earlier in section~\ref{sec:HRVdefs}, which are AverageNN, SDNN, RMSSD, pNN50, and SVI.  These are estimated, together with $W_t$, over a short-time window of duration $\tau = 40$ s, with subsequent windows overlapped by \mbox{20 s}.

Figure~\ref{fig:HRV_Example} shows HRV features estimated for an exemplar subject. During the second section of the experiment, it may be seen that the increased movement of the subject results in substantial errors in the PPG signal that propagate to the HRV features.

\begin{figure}
\includegraphics[width=0.48\textwidth]{InternalNoiseWhitePaper-010}
\caption{\label{fig:HRV_Example} HRV features estimated from P-P intervals acquired from PPG (red) and from R-R intervals acquired from ECG (black), in reading order.  The lower plot shows the time-series of accelerometry $W_t$, with mean and one s.d. values within a window of $\tau = 40$ s shown in black and red, respectively.}
\end{figure}

% I suggest removing this second page of plots, because the errors are obvious from the first page of plots.
%Assuming that the ECG signal to be error free, we can measure the error between the HRV features calculated on the band with respect to the same features calculated on the ECG device.

%\begin{figure}
%\includegraphics[width=\textwidth]{InternalNoiseWhitePaper-010}
%\end{figure}

For this exemplar patient, we can see that the standard deviation of the accelerometry time-series $W_t$ is correlated to the magnitude of the errors in the time-domain HRV features, with correlation coefficients: $\rho = 0.91$, 0.84, 0.67, and 0.64 for AverageNN, SDNN, pNN50, and RMSSD, respectively.  However, this correlation does not exist for the frequency-domain HRV feature, SVI, for which the corresponding correlation coefficient is $\rho = -0.03$.  We will investigate this latter phenomenon in a subsequent section of this paper.

\subsection{Discarding Data with Low Signal Quality}
\label{sec:threshold}

Having confirmed above the intuition that error in HRV feature estimation is correlated with movement, we subsequently choose to estimate signal quality via the accelerometry time-series $W_t$, such that HRV estimates may be discarded if $W_t$ exceeds some threshold $\kappa$.

% We therefore calculated the distribution of error for each HRV feature, as a function of the value of $W_t$, as shown in figure~\ref{fig:AccThreshold}.  The figure shows error distributions for an exemplar patient, with the quantile of $W_t$ shown on the horizontal axis; equivalent plots for other subjects, which are consistent with that included here, are not shown for brevity.  The figure shows that the time-domain HRV features (shown in the upper four sub-plots) tend to have error increasing with the quantile of $W_t$, confirming the results of the previous section (whereas again SVI does not show this behaviour).  We choose an example threshold at the 0.8 quantile on $W_t$ for the remainder of this work (which corresponds to an absolute value of $\kappa = 0.02$), following the observation that errors in HRV estimation tend to increase substantially for $\kappa$ above this value.

We therefore calculated the distribution of error for each HRV feature, as a function of the value of $W_t$ (the average of $w_t$ over the window of duration $\tau$), and noticed that error for most of the HRV features (Average NN, SDNN, RMSSD, and pNN50) quickly increases for $W_t>0.02$: the error for Average NN goes from  0.0013 ($W_t<0.02$) to 0.0142 ($W_t>0.02$); the error for SDNN goes from  0.0061  ($W_t<0.02$) to 0.0139 ($W_t>0.02$); the error for RMSSD goes from  0.0079  ($W_t<0.02$) to 0.0153 ($W_t>0.02$); the error for RMSSD goes from  0.057  ($W_t<0.02$) to 0.125 ($W_t>0.02$). SVI is the only HRV feature whose error doesn't change with $W_t>0.02$. Following the observation that, for most of the HRV features, the error is an order of magnitude lower than the value of the corresponding HRV feature for $W_t<0.02$, and that the error becomes of the same order of magnitude as the value of the HRV feature for $W_t>0.02$, we choose a threshold of $\kappa = 0.02$ for the remainder of this work. We emphasise that this is a candidate $\kappa$, given the prototype nature of the study, conducted on a small patient group, and which would naturally be more principled in formulation for a subsequent larger study.

\subsection{Signal Realignment}
\label{sec:analysis}

The final step in our pre-processing is to find (and correct for) any time-offset that might between the PPG and ECG.  This is straightforwardly performed by comparing the pre-processed time-series of P-P intervals and R-R intervals, and calculating the squared-distance $d$ between the two for a varying time-offset $\alpha$.  We note that the P-P and R-R intervals are not sampled at corresponding times, and therefore both waveforms were resampled at 10 Hz.

Figure~\ref{fig:TimeOffset} shows this relationship for an exemplar patient, which is reproduced across other subjects (not shown here for brevity).  We choose a value of $\alpha = 2.2$ s, which corresponds to the value that minimises $d$.

\begin{figure}
\includegraphics[width=0.48\textwidth]
{InternalNoiseWhitePaper-020}
\caption{\label{fig:TimeOffset} Squared-distance $d$ between pre-processed P-P and R-R intervals, as a function of time-offset $\alpha$ between them (seconds).}
\end{figure}

\section{Results}
\label{sec:all_users}

This section presents results of (i) investigating the effect of changing window-size $\tau$ when calculating HRV features; (ii) investigating the signal-to-noise ratio for the time-series of P-P interval estimated from the PPG, with respect to the reference R-R intervals derived from the ECG; and (iii) the distribution of errors for HRV features throughout the four stages of the experimental protocol.

\subsection{Effect of Window Size}

Table \ref{tab:RMS} shows the root mean-square error (RMSE) of each HRV feature for various window sizes $\tau$.  It may be seen that the RMSE does not change substantially with varying $tau$; errors increase with window size for AverageNN ($\approx 10\%$), RMSSD ($\approx 10\%$), and pNN50 ($\approx 2\%$), while the RMSE decreases for SDNN ($\approx 25\%$) and SVI ($\approx 30\%$). However, it may be seen from the table that the decrease of SVI is not proportional to changes in $\tau$.

%% It's probably safe to remove this figure, as the story is told in the table of results.
%\begin{figure}
%\includegraphics[width=\textwidth]{InternalNoiseWhitePaper-012}
%\end{figure}

\begin{table}
\caption{\label{tab:RMS} RMSE of HRV features, for window size $\tau$}
\centering
\begin{tabular}{llllll}
$\tau$ (s) & \textbf{AverageNN}   & \textbf{SDNN}   & \textbf{RMSSD}  & \textbf{pNN50}  & \textbf{SVI}   \\ \hline
40                & 0.0480 & 0.0334 & 0.0564 & 0.2285 & 0.6471 \\
60                & 0.0489 & 0.0316 & 0.0566 & 0.2294 & 0.5683 \\
80                & 0.0499 & 0.0294 & 0.0575 & 0.2279 & 0.6080 \\
100                & 0.0504 & 0.0287 & 0.0583 & 0.2330 & 0.5982 \\
120                & 0.0506 & 0.0280 & 0.0575 & 0.2259 & 0.6613 \\
\end{tabular}
\end{table}

It is common practice to require long-duration windows of data to estimate HRV features relaibly. Our experiment shows that short-duration windows of data still allow to perform accurate estimation of time-domain HRV features.

\subsection{Signal-to-Noise Ratio}

%% Having corrected for alpha already, we can now simply refer to the difference between the two realigned time-series of R-R intervals, and can therefore avoid the following lines.
%We model the relationship between PPG, ECG, Noise, and Time, as follows:
%\begin{itemize}
%\item we call $f(t)$ the function of the PPG sensor over time $t$
%\item we call $g(t)$ the function of the real RR value. We assume the ECG sensor to give us the true RR values for any given value of $t$.
%\item we call $\alpha$ the time shift between ECG and PPG, it's the delay between the real heartbeat and the detected heartbeat
%\item we call $r(t)$ the function of the noise present in PPG
%\end{itemize}
%
%\begin{equation}
%\label{PPGModel}
%f(t)=g(t+\alpha)+r(t)
%\end{equation}
%
%To characterize the noise function $r$ we will initially fit the data to find $\alpha$, then define $r(t)$ as the difference of $f(t)$ and $g(t+\alpha)$.
%
%PPG and ECG are points not equally distributed in time. We start by resampling both signals, by interpolating the values over a regular grid of values for $t$, we resample at 10 Hz.
%
%In the following graph the black line is the reference ECG signal, the red line is the unfiltered PPG signal, the green line is the PPG signal with a low pass filter (implemented as described in section \ref{sec:lopass}, using a short sliding window of size 5 on the PPG resampled at 10 Hz). It can be noticed that the PPG signals have a small delay with respect to the ECG signal.
%

%%%%%%%%%%%%%%%%%%%%%%%
% Removing this figure because it does not obviously show any difference between the signals - we have previously accounted for the time realignment of alpha = 2.2 s
%\begin{figure}
%\includegraphics[width=\textwidth]{InternalNoiseWhitePaper-018}
%\end{figure}
%
%
%\begin{figure}
%\includegraphics[width=\textwidth]{InternalNoiseWhitePaper-021}
%\end{figure}
%
%We can now define $r(t)=f(t)-g(t+\alpha)$

%%%%%%%%%%%%%%%%%%%%%
% Removing this figure because it does not show the differences between ECG- and PPG-derived signals clearly - the later SNR plot should be sufficient
%\begin{figure}
%\includegraphics[width=\textwidth]{InternalNoiseWhitePaper-022}
%\end{figure}

Noting that the ECG-derived time-series of R-R intervals $RR$ is used as the reference, we can define the time-series of residuals $r_t = RR - PP$, where the time-series of re-aligned P-P intervals from the PPG is $PP$.

Figure~\ref{fig:SNRspectra} shows the spectra of $RR$ compared with the residual time-series $r_t$ when calculated with and without preprocessing of the time-series of P-P intervals derived from the PPG.

\begin{figure}
\includegraphics[width=0.48\textwidth]{InternalNoiseWhitePaper-024}
\caption{\label{fig:SNRspectra} Spectra for the signal $RR$ vs. residuals $r_t$ where the latter have been calculated from the original (``noise") and pre-processed (``noise filtered'') signals $PP$, shown in red and green, respectively.  The vertical lines show the frequency bands used in HRV analysis: LF between 0.04 and 0.15 Hz, and HF between 0.15 and 0.4 Hz.}
\end{figure}

Additionally, we can plot the signal-to-noise ratio (SNR) between $RR$ (the ``signal'') and $r_t = RR - PP$ (the ``noise'') for the cases with and without pre-processing of $PP$, as shown in figure~\ref{fig:SNR}.

\begin{figure}
\includegraphics[width=0.48\textwidth]{InternalNoiseWhitePaper-025}
\caption{\label{fig:SNR}  SNR between $RR$ (signal) and residuals $r_t$ (noise), with and without pre-processing of $PP$ shown in green and black, respectively.  A horizontal line shows SNR = 1.0.}
\end{figure}

Figures~\ref{fig:SNRspectra} and \ref{fig:SNR} show that the power in the signal exceeds that of the noise for the ultra-low frequency band (i.e., those frequencies below LF).  This is an expected result, because power in this band corresponds to slowly-changing physiological phenomena that modulate the time-series of P-P and R-R intervals (corresponding to the heart rate) - this corresponds to diurnal changes in blood pressure, temperature regulation, and other effects.

Both the LF and HF bands have a very low SNR. The LF band frequently exceeds SNR = 1.0 for the case in which the P-P intervals from the PPG have been pre-processed. HF band has a signal-to-noise ratio close to, or below, SNR = 1.0, which corresponds to the fact that the noise is at least as powerful as the signal in this band.  We note also that the absolute  power in the HF band is low with respect to the lower-frequency bands (as shown in figure~\ref{fig:SNRspectra}).  This latter effect may explain why SVI is as unreliable as has been observed by our results: noting that SVI is the ratio between LF and HF, with HF in the denominator, it is therefore sensitive to HF noise.  We may observe that the pre-processed (``filtered") PPG has a higher signal-to-noise ratio than the unprocessed (``unfiltered'') PPG in the HF band. We conclude that SVI is not a reliable HRV feature and should be used with caution, ensuring our pre-processing steps are performed.

\begin{figure}
\includegraphics[width=0.48\textwidth]{HF-LF}
\caption{\label{fig:HFLF} Distribution of signal-to-noise ratio in HF and LF bands for all subjects.  SNR = 1.0 is shown with the vertical dashed line; values to the left of this line correspond to a proportion of subjects' data that falls below SNR = 1.0.}
\end{figure}

Figure \ref{fig:HFLF} shows the distribution of signal-to-noise ratios for HF and LF bands across all subjects, where we emphasise that these distributions are normalised histograms.  The figure shows that HF values frequently fall below the value of SNR = 1 (i.e., that part of the distribution shown in black that lies to the left of the vertical dashed line). This indicates that HF values are not reliable for the majority of patients. LF values are appear to be more reliable than HF, since a larger proportion of the distribution shown in red falls above SNR = 1.


\subsection{Distributions of HRV Errors for all subjects}

In the previous sections we applied the accelerometer based noise filtering and subsequent HRV analysis to the data collected from a single user. In this section we replicate the same procedure to the data collected from all users. For every HRV feature we aggregate the results and we calculate the mean, the standard deviation, the 25th, 50th, and 75th percentiles. We present those results as statistical descriptors of the expected error propagation from PPG to HRV features.

Table \ref{distr.acc} shows the distribution of accelerometry $W_t$ over all subjects in the four stages of the experimental protocol (\emph{rest}, \emph{stress}, \emph{recovery}, and \emph{free}). As expected, the \textit{rest} and \textit{recovery} stages have similar accelerometry, with more than 75\% of the $W_t$ values below our threshold $\kappa$ value of $W_t = 0.02$).  During the \textit{free} stage, values of $W_t$ fall below 0.02 than 50\% of the time.  During the \textit{stress} stage, $W_t$ consistently exceeds the threshold $\kappa$.

% latex table generated in R 3.2.3 by xtable 1.8-2 package
% Mon Dec  5 15:37:27 2016
\begin{table}[ht]
\caption{\label{distr.acc} Distribution of accelerometry $W_t$, showing the mean and \\s.d. across all subjects, and the quantiles on the distribution of $W_t$ \\at 0.1, 0.25, 0.75, and 0.9.}
\centering
\begin{tabular}{rrrrrrrr}
  \hline
 & mean & std dev &  0.25 & 0.5 & 0.75 & 0.9 \\
  \hline
rest & 0.016 & 0.032 & 0.002 & 0.002 & 0.010 & 0.072 \\
  stress & 0.406 & 0.202 & 0.212 & 0.471 & 0.577 & 0.600 \\
  recov & 0.012 & 0.035 & 0.002 & 0.003 & 0.007 & 0.011 \\
  free & 0.052 & 0.032 & 0.027 & 0.057 & 0.075 & 0.089 \\
   \hline
\end{tabular}
\end{table}


Tables \ref{distr.averageNN}, \ref{distr.SDNN.error}, \ref{distr.RMSSD.error}, and \ref{distr.pNN50.error} show the distribution of errors in the time-domain HRV features, for each phase. Reflecting the distribution of the accelerometry $W_t$, the \textit{rest} and \textit{recovery} stages have low error most of the time (75\%), the \textit{free} stage has low error between 25\% and 50\% of the time, and the \textit{stress} stage is consistently associated with large error in HRV features.

% latex table generated in R 3.2.3 by xtable 1.8-2 package
% Mon Dec  5 15:37:51 2016
\begin{table}[ht]
\caption{Distribution of Average NN error, showing the mean and s.d. \\across all subjects, and the quantiles on the distribution of \\Average NN error at 0.1, 0.25,  0.75, and 0.9.}
\label{distr.averageNN}
\centering
\begin{tabular}{rrrrrrrr}
  \hline
 & mean & std dev &  0.25 & 0.5 & 0.75 & 0.9 \\
  \hline
rest & 0.004 & 0.010 &0.001 & 0.001 & 0.002 & 0.008 \\
  stress & 0.127 & 0.052 & 0.088 & 0.124 & 0.155 & 0.194 \\
  recov & 0.007 & 0.020 & 0.001 & 0.001 & 0.003 & 0.011 \\
  free & 0.043 & 0.032 & 0.009 & 0.042 & 0.072 & 0.082 \\
   \hline
\end{tabular}
\end{table}

% latex table generated in R 3.2.3 by xtable 1.8-2 package
% Mon Dec  5 15:38:05 2016
\begin{table}[ht]
\caption{Distribution of SDNN error, showing the mean and s.d. \\across all subjects, and the quantiles on the distribution of SDNN \\error at 0.1, 0.25, 0.75, and 0.9.}
\label{distr.SDNN.error}
\centering
\begin{tabular}{rrrrrrrr}
  \hline
 & mean & std dev & 0.25 & 0.5 & 0.75 & 0.9 \\
  \hline
rest & 0.012 & 0.011 & 0.004 & 0.009 & 0.016 & 0.022 \\
  stress & 0.132 & 0.036 & 0.111 & 0.133 & 0.166 & 0.179 \\
  recov & 0.006 & 0.014 & 0.001 & 0.003 & 0.006 & 0.015 \\
  free & 0.030 & 0.022 & 0.009 & 0.028 & 0.049 & 0.061 \\
   \hline
\end{tabular}

\end{table}

% Mon Dec  5 15:38:20 2016
\begin{table}[ht]
\caption{Distribution of RMSSD error, showing the mean and s.d. \\across all subjects, and the quantiles on the distribution of RMSSD \\error at 0.1, 0.25, 0.75, and 0.9.}
\label{distr.RMSSD.error}
\centering
\begin{tabular}{rrrrrrrr}
  \hline
 & mean & std dev & 0.25 & 0.5 & 0.75 & 0.9 \\
  \hline
rest & 0.025 & 0.014 & 0.016 & 0.024 & 0.031 & 0.038 \\
  stress & 0.078 & 0.022 & 0.064 & 0.079 & 0.089 & 0.107 \\
  recov & 0.008 & 0.011 & 0.003 & 0.004 & 0.008 & 0.019 \\
  free & 0.033 & 0.020 & 0.017 & 0.034 & 0.049 & 0.056 \\
   \hline
\end{tabular}
\end{table}

% latex table generated in R 3.2.3 by xtable 1.8-2 package
% Tue May  9 09:43:16 2017
\begin{table}[ht]
\caption{Distribution of pNN50 error, showing the mean and s.d. \\across all subjects, and the quantiles on the distribution of pNN50 \\error at 0.1, 0.25, 0.75, and 0.9.}
\label{distr.pNN50.error}
\centering
\begin{tabular}{rrrrrrrr}
  \hline
 & mean & std dev & 0.25 & 0.5 & 0.75 & 0.9 \\
  \hline
rest & 0.238 & 0.107 & 0.167 & 0.235 & 0.293 & 0.377 \\
  stress & 0.511 & 0.086 & 0.438 & 0.525 & 0.565 & 0.634 \\
  recov & 0.021 & 0.049 & 0.000 & 0.000 & 0.030 & 0.060 \\
  free & 0.174 & 0.116 & 0.076 & 0.165 & 0.260 & 0.332 \\
   \hline
\end{tabular}
\end{table}


Table \ref{distr.SVI.error} shows the error associated with the frequency-domain HRV feature, SVI.  As concluded previously, this feature appears to be generally less reliable than the time-domain HRV features, across all subjects.  The large errors present in the estimation of SVI, reported in table \ref{distr.SVI.error}, are due to the low signal-to-noise ratio of the HF band.

% latex table generated in R 3.2.3 by xtable 1.8-2 package
% Tue May  9 09:42:51 2017
\begin{table}[ht]
\caption{Distribution of SVI error, showing the mean and s.d. \\across all subjects, and the quantiles on the distribution of SVI \\error at 0.1, 0.25, 0.75, and 0.9.}
\label{distr.SVI.error}
\centering
\begin{tabular}{rrrrrrrr}
  \hline
 & mean & std dev & 0.25 & 0.5 & 0.75 & 0.9 \\
  \hline
rest & 1.536 & 1.298 & 0.745 & 1.022 & 2.099 & 2.377 \\
  stress & 0.611 & 0.535 & 0.147 & 0.451 & 0.772 & 1.515 \\
  recov & 0.659 & 0.452 & 0.332 & 0.537 & 0.932 & 1.390 \\
  free & 1.308 & 0.994 & 0.512 & 1.112 & 2.057 & 2.948 \\
   \hline
\end{tabular}
\end{table}


\section{Conclusions}

We have shown that PPG data acquired from a consumer-grade wrist-worn wearable device are highly susceptible to motion artefacts.  We have analysed the noise profile, and shown that the frequency-domain HRV feature SVI is not reliable, because the signal-to-noise ratio in the HF band (which is in the denominator of the quotient that defines SVI) often falls below a value of SNR = 1.0.

Our results demonstrate that HRV features extracted when the user is still are reliable, even if the user is not in a cardiovascular stationary state (such as in the third stage of our experimental protocol, ``recovery"), which therefore does not agree with the findings described in the literature \cite{teng_study_2003}.

We have shown that is possible to use the accelerometry $W_t$ derived from the wearable device to estimate the quality of the corresponding PPG signal.  Therefore, unreliable data can automatically be discarded according to a threshold $\kappa$ on $W_t$.  Such an operation could be used to selectively turn off the PPG sensor, thereby saving battery life on the wearable device, and also avoiding HRV analysis using unreliable data. We derive a value of $\kappa$ that retain data with error an order of magnitude lower than the signal for most HRV features, discarding data with higher error. The value of $\kappa$ should be refined with a larger dataset.

We have shown that the conventional use of long-duration windows of data is not needed to perform accurate estimation of time-domain HRV features.

We emphasise that the results described in this report represent a preliminary study, and planned future work includes validation of these results with more subjects to verify our findings.


%\begin{acknowledgements}
%If you'd like to thank anyone, place your comments here
%and remove the percent signs.
%\end{acknowledgements}


\bibliographystyle{plain}
\bibliography{BioBeatsResearch}

% BibTeX users please use one of
%\bibliographystyle{spbasic}      % basic style, author-year citations
%\bibliographystyle{spmpsci}      % mathematics and physical sciences
%\bibliographystyle{spphys}       % APS-like style for physics
%\bibliography{}   % name your BibTeX data base



\end{document}
% end of file template.tex
