Facilitating ambulatory heart rate variability analysis using accelerometry-based classifications of body position and self-reported sleep

Objective. This study aimed to examine differences in heart rate variability (HRV) across accelerometer-derived position, self-reported sleep, and different summary measures (sleep, 24 h HRV) in free-living settings using open-source methodology. Approach. HRV is a biomarker of autonomic activity. As it is strongly affected by factors such as physical behaviour, stress, and sleep, ambulatory HRV analysis is challenging. Beat-to-beat heart rate (HR) and accelerometry data were collected using single-lead electrocardiography and trunk- and thigh-worn accelerometers among 160 adults participating in the SCREENS trial. HR files were processed and analysed in the RHRV R package. Start time and duration spent in physical behaviours were extracted, and time and frequency analysis for each episode was performed. Differences in HRV estimates across activities were compared using linear mixed models adjusted for age and sex with subject ID as random effect. Next, repeated-measures Bland–Altman analysis was used to compare 24 h RMSSD estimates to HRV during self-reported sleep. Sensitivity analyses evaluated the accuracy of the methodology, and the approach of employing accelerometer-determined episodes to examine activity-independent HRV was described. Main results. HRV was estimated for 31 289 episodes in 160 individuals (53.1% female) at a mean age of 41.4 years. Significant differences in HR and most markers of HRV were found across positions [Mean differences RMSSD: Sitting (Reference) − Standing (−2.63 ms) or Lying (4.53 ms)]. Moreover, ambulatory HRV differed significantly across sleep status, and poor agreement between 24 h estimates compared to sleep HRV was detected. Sensitivity analyses confirmed that removing the first and last 30 s of accelerometry-determined HR episodes was an accurate strategy to account for orthostatic effects. Significance. Ambulatory HRV differed significantly across accelerometry-assigned positions and sleep. The proposed approach for free-living HRV analysis may be an effective strategy to remove confounding by physical activity when the aim is to monitor general autonomic stress.


Introduction
Heart rate variability (HRV) is a complex biomarker of the cardiac adaptability to internal and external challenges such as stress, exercise, and disease (Task Force of the European Society of Cardiology and the North American Society of Pacing and Electrophysiology 1996).While HRV measurements are a staple in commercial wearables commonly used in free-living research, there is a lack of transparent and open-source methodologies to analyse continuous ambulatory HRV.
The cardiac system is innervated by the central nervous system, which adapts cardiac activity through the autonomous nervous system (ANS) in response to several stimuli such as visual and auditory afference, emotions, and physiological signalling from entities such as chemo-and baroreceptors (McCraty and Shaffer 2015).When stimuli are processed, the ANS is innervated via pre-and post-ganglionic neurons, and cardiac activity is adapted leading to a change in heart rate (HR) represented as HRV, and cardiac output in response (Zaglia and Mongillo 2017).Therefore, HRV represents fluctuations in the vagal and sympathetic innervation of the ANS (Task Force of the European Society of Cardiology and the North American Society of Pacing and Electrophysiology 1996).The activity of the parasympathetic nervous system results in quick, brief decreases in heart rate, leading to high-frequency fluctuations in HRV.Conversely, the activity of the sympathetic nervous system leads to slower and more prolonged changes in heart rate, resulting in low-frequency fluctuations in HRV (Ernst 2017).
Ambulatory recordings of HRV are affected by an individual's behaviour, including sleep (Chalmers et al 2022), activity status (Pradhapan et al 2014), and posture (Smith et al 1994), as these are closely related to the ANS.Other non-modifiable factors such as age (Garavaglia et al 2021), sex (Koenig and Thayer 2016), and ethnicity (Hill et al 2015) have also been reported to be associated with cardiac adaptability.In detail, a change in posture or even trunk position requires a rapid change in innervation of the cardiac muscle tissue to maintain stable blood flow to the brain and internal organs (Frey et al 1994, Wang et al 2022).When standing up, the venous return drastically decreases compared to when sitting or lying down.This results in a decrease in cardiac output, mean arterial blood pressure, and leads to the activation of sympathetic neurons via baroreceptors (Frey et al 1994).Consequently, the sympathetic nervous system is activated which partly results in an increase in HR and cardiac contractility.When this mechanism is insufficient, individuals may experience orthostatic hypotension as their cardiac innervation does not lead to sufficient blood supply to the brain (Gilani et al 2021).Moreover, HRV varies significantly across sleep stages.During rapid eye movement (REM) sleep, sympathetic cardiac innervation may lead to HRV measurements that are similar to wakefulness (Tobaldini et al 2013).Additionally, breathing during sleep may be irregular (Somers et al 1993) which may influence HRV assessments.In contrast, non-rapid eye movement (NREM) sleep, such as slow-wave-sleep, is characterized by a decrease in HR, blood pressure, and low sympathetic nerve activity (Somers et al 1993).During the night, healthy individuals cycle through the NREM (75%) and REM (25%) sleep stages which results in substantial changes in breathing rate, HR, and HRV (Patel et al 2022).
To appropriately record and analyse ambulatory HRV, standardized methodologies to adjust for behaviours in a free-living setting are warranted, particularly, since it is recommended to analyse HRV in a research environment where similar measurement conditions are ensured for each subject (Task Force of the European Society of Cardiology and the North American Society of Pacing and Electrophysiology 1996).A common methodology to assess objective behaviour and physical activity is accelerometry.Using accelerometry, one could potentially correct HRV for environmental and lifestyle-related confounders in order to reach stable measurement conditions such as previously reported in an animal model (Oishi et al 2018).
In field-based, experimental, and cohort studies following participants for longer periods of time, methodologies to assess outcomes is required to be cost-efficient, specific, and available to be used in a larger sample size than in a laboratory setting.Therefore, small tracking devices recording HR (Haveman et al 2022), accelerometry (Dowd et al 2018), and other physiological parameters (Haveman et al 2022) are commonly used in ambulatory settings.HRV is an attractive endpoint to consider in this context, as it may be employed to evaluate the effects of lifestyle interventions on an individual's psychological stress levels (Kim et al 2018), health (Fournié et al 2021), and recovery from exercise (Kingsley and Figueroa 2016).Recently, several producers of commercial wearable devices have introduced an HRV estimate to their individual users and for the research community (Miller et al 2022).While there is detailed documentation over the recorded biomarkers and physiological implications of the biofeedback (Firstbeat Technologies Ltd 2014, Bellenger et al 2021, 2023), the algorithms estimating HRV and stress-or recovery-indexes are commonly proprietary due to their commercial values (e.g.Patent IDs US9750415B2, EP1545309B1, US10842429B2).This is a limiting factor on academic research as investigators are required to have an insight into all data processing and handling to accurately reproduce and report their scientific findings.Besides, as HRV results are heavily affected by pre-processing and filtering of HR measurements, a large diversity in data handling methodology has precedingly limited the comparability and reproducibility of current scientific evidence (Ishaque et al 2021).Consequently, automated, and transparent methods using freely available software are favourable to the standardization of ambulatory HRV assessments in academic research.
The aims of this study were twofold: Firstly, to describe and compare HRV estimates obtained during various accelerometer-determined positions and sleep in a natural environment, and secondly, to compare long-term recordings of HRV during sleep to the current 24 h HRV processing standard (Task Force of the European Society of Cardiology and the North American Society of Pacing and Electrophysiology 1996).By using an open-source R package to realise these aims, we carefully present a transparent and automated methodology to analyse HRV data obtained in free-living settings.

Study population
HRV was recorded among 160 adults participating in the SCREENS randomised controlled trial (RCT) for a total of six days.The SCREENS trial was originally designed to examine the effect of a two-week screen time reduction on health and behaviour in families.It has previously been described in detail (Rasmussen et al 2020).Briefly, inclusion criteria for the clinical trial were to live in a family with children who were ⩾4 years old, to consume >2.4 h of screen time per day, and to be in full-time studies or employment.Regular night shifts, inability to be physically active, diagnosed sleep disorders, neuropsychiatric disorders, developmental disorders, and sick leave due to stress during the last three months were exclusion criteria as well.Data obtained for this study was recorded in 68 parent pairs as well as 24 individuals where the other partner did not participate in data collection (17 female, 7 male).The present study utilised both baseline and follow-up data from the SCREENS trial as the comparisons of HRV across episode classifications are likely unaffected by the intervention.Sample characteristics including age, height, weight, and mean daily moderate-to-vigorous physical activity (MVPA) were recorded at baseline.

Data collection
HR and accelerometry data were collected using Firstbeat Bodyguard 2 (FB2, Finland) and Axivity AX3 devices (United Kingdom) (Rasmussen et al 2020), respectively.Self-reported sleep was assessed by sleep journals on the same nights as HR and accelerometry were recorded.Accelerometers were placed on the thigh and trunk.The FB2 and Axivity AX3 were initialised on the same computer to ensure that real-time clocks in the devices were synchronised.With a maximum of three consecutive recording days, it was expected that the clock drift is minimal (Brønd et al 2021).Unique HR data files were generated for each measurement session when a device was removed and reattached.In post-processing, all HR recordings of an individual were combined into one data file for baseline and follow-up recordings, separately.After data preparation, HR files containing interbeat intervals for each participant were loaded into an HRV data structure in the RHRV R package (Martinez et al 2017).In RHRV, data was processed by generating HR, filtering for missing beats, ectopic beats, and arrhythmias, and interpolating the HR at a frequency of 4 Hz.The filtering was done at a minimum HR of 25 beats per minute (bpm), a maximum HR of (220 bpm-age), and otherwise using default RHRV settings, twice, consecutively.
Employing an algorithm, start time and duration (seconds) spent in the activities sitting, standing, and lying were extracted for each participant in the form of episodes spent in an activity.This activity type classification algorithm was developed by Skotte et al (2014) and has previously been described in detail (Rasmussen et al 2021).While the algorithm also identified episodes of walking (468 episodes), running (48 episodes), and biking (75 episodes), episode counts were too small to be included in this study.Accelerometer-determined episodes of lying down were differentiated into awake and asleep states using self-report sleep journals (Pedersen et al 2022).Moreover, 24 h HRV episodes were computed from the self-reported wake-up time.Total self-reported sleep (bedtime-waketime) and normalized sleep (0:00-5:00) intervals were additionally introduced as episodes for analysis.
All activity episodes extracted from accelerometry were added to the HRV data structure in RHRV as time episodes.Each behaviour episode was assigned a unique HRV Tag.The HRV Tags were generated using subject ID, activity type, and a unique list identifier for each episode.Activity episodes recorded outside of HR measurements were discarded employing a clock time variable corresponding to the recording.To qualify for time and frequency analysis, a minimum episode duration of 360 s for each bout was required.The first and last 30 s of each episode were removed to adjust for immediate changes in HRV associated with hemodynamic changes rather than the position or sleep status itself, and this ensures a minimum epoch duration of five minutes (300 s).

Modification of RHRV
A complete script consisting of R loops and multiple functions was used to automate the extraction of all HRV outcomes by episode.One function used to extract HRV time analysis outcomes by episodes is currently not implemented and was thus obtained from an RHRV admin in a forum (CreateTimeAnalysisByEpisodes) (2014).Furthermore, the time-analysis and frequency analysis functions were modified to only report HRV outcomes within episodes to decrease the processing time.Next, the code was modified to recognize missing beats as NA.We additionally provide R package code in a publicly available GitHub repository that integrates the readily available RHRV R package with code as well as a tutorial to analyse HRV using pre-defined episodes (Link: https://github.com/marleriee/RHRV_SDU).

HRV outcomes
HRV outcomes were computed for each accelerometer-determined episode, individually.As it is recommended to use three statistical and one geometric assessment of HRV for HRV time analyses (Task Force of the European Society of Cardiology and the North American Society of Pacing and Electrophysiology 1996), time-analysis outcomes investigated were the SD of R-R intervals (SDNN, ms), the percentage of adjacent R-R-intervals differing from each other by >50 ms (pNN50, %), the root-mean square of the successive difference of R-R intervals (RMSSD, ms), and the geometric HRV triangular index (HRVi).Time analyses were carried out using a segment size of 300 s at a width of bins in R-R interval histograms of 7.8125 ms.Most time-analysis outcomes are commonly sensitive to episode duration as the estimates are based on the absolute R-R interval.The RMSSD however, is estimated based on the changes in the R-R intervals (differences between each successive pair of intervals), and it is therefore less sensitive to absolute changes in HR and thus episode duration as compared to SDNN and HRVi.Accordingly, the RMSSD was used as main outcome for our analyses.In frequency analysis, power band calculations were performed using Fourier transformation.Then, powerbands were split by accelerometer-determined episodes.Power in very low frequency (VLF, 0.0033-0.04Hz), low frequency (LF, 0.04-0.15Hz), and high frequency (HF, 0.15-0.4Hz) were computed for intervals of 300 s with a frame shift of 60 s.Mean total power (SD) of VLF, LF, and HF were extracted.Furthermore, normalized units of LF and HF were computed using the equations LF nu = LF/(VLF + LF + HF) and HF nu = HF/(VLF + LF + HF) (Burr 2007).After HRV outcomes were estimated, extreme outliers, i.e. episodes with a RMSSD > 3SD than the mean for corresponding activity types, were removed.This limit was in good agreement with expected maximum RMSSD.Outlier removal resulted in a removal of 1746 out of 32 526 (5.4%) episodes in the activities sitting, standing, and lying, and 217 out of 2411 (9.0%) episodes in 24 h-and self-reported sleep-intervals.Variation analyses suggested that outliers in HRV estimates may be due to incorrect attachment of the FB2 or motion artefacts.

Statistical analysis
Descriptive information on sample characteristics were cross-tabulated.Distributions of HRV outcomes were examined using histograms.HRV parameters that were not normally distributed and did not include zeros were log-transformed.Moreover, summary statistics for raw HRV as mean (SD) for normally distributed variables and median [inter-quartile range (IQR)] for non-normally distributed variables in activities were presented for male and female participants, separately.RMSSD in continuous accelerometer-determined episodes of positions, sleep, and 24 h summaries were plotted for person-days with >50 episodes.The plots presented in this publication were chosen based on complete sleep data, a shared household, and diversity of recorded episodes.Mean differences between activities and across sleep status were estimated using linear mixed models adjusted for age and sex (fixed effects) with subject ID as random effect for outcomes with normal distribution before or after log-transformation.As pNN50 describes a percentage and included zeros, this outcome was unable to be log-transformed.Therefore, a generalised linear mixed model with binomial probability-distribution function and identity link was employed to estimate mean differences (Yiengprugsawan et al 2010).Reliability of episode-specific HRV outcomes was estimated from variance components of the mixed model to calculate intraclass correlation coefficients for all models except pNN50 (ICC, [def].proportion of the total variance in the HRV outcome that is due to differences between subjects) (Rabe-Hesketh and Skrondal 2008).A high ICC was interpreted as no or minor within-subject variability in the HRV measures across all positions and sleep states included in the models and that the variability observed in the data is due to differences between subjects (Gelman and Hill 2007).
Furthermore, night-time RMSSD determined by sleeping schedule was compared to current clinical practice 24 h RMSSD measurements by evaluating mean differences computed using linear mixed models as well as agreement examined in nested repeated-measures Bland-Altman analyses for 24 h intervals in contrast to total self-reported sleep and normalized sleep (0:00-5:00).Limits of agreement (LoA) and concordance correlation coefficients (CCC) were computed.Statistical testing was carried out in R (Version 4.3.0)at a significance level of p < 0.05.

Sensitivity analysis
The impact of removing the first and last 30 s of each episode was examined by running a repeated Bland-Altman analysis comparing HRV estimates in episodes adjusted for immediate changes in position with results for raw episodes at 95% LoA (Bland and Altman 2007).To achieve the computational power required to run an agreement analysis for <30 000 datapoints, the analysis was carried out manually following methodology obtained from a forum by R Project (Benjamin 2008).At a significance level of 0.05, pair-wise differences and means were computed.We calculated the mean difference and SD, performed a one-way analysis for pair-wise differences based on subject ID to address inter-individual effects, and generated a Bland-Altman plot once we had computed the 95% LoA.Inter-and intra-individual variance was described.Next, the effect of episode duration on differences between adjusted and raw episode estimates was characterised using linear mixed models with difference between methods as response variable, HRV duration of uncut episodes as predictor, and ID as random effect.Finally, the variance in HRV outcomes within individuals was compared between unique body positions, sleep, and 24 h-assessments by computing ICC estimates for linear mixed models ran on a subset of each type of episode classification.

Sample characteristics
During baseline and follow-up data collection within the SCREEN trial, HRV was estimated for 31 289 episodes of accelerometer-determined activity (sitting, standing, lying) in 160 individuals (52.8% female) at a mean age (SD) of 41.44 (±5.0) years.After data cleaning, an average (SD) of 78.39 (±24.65)h of heart rate recordings in accelerometer-determined activities were available for each subject.Moreover, 2207 episodes describing HRV in 24 h-intervals and sleep were analysed using self-reported sleep data.Sample characteristics cross-tabulated by sex are presented in table 1. Female and male participants reported a mean BMI (SD) of 25.1 (±4.0) kg m −2 and 26.6 (±2.9) kg m −2 , respectively, and accelerometer-measured mean (SD) daily MVPA within the sample was 15.1 (± 11.9) min.Male participants were significantly older, taller, heavier, had a larger BMI, and they reported marginally reduced sleep duration compared to female participants.Additionally, participants reported a mean (SD) of 7.6 (±1.1) h of sleep per day.Mean (SD) for all HRV outcomes across sex are presented for accelerometer-determined activities in table 2. Summary statistics for HRV during sleep and 24 h intervals are shown in supplementary table 1.

HRV across positions
To examine differences in HRV across accelerometer-determined positions, linear mixed models for HRV as response variable with the fixed effects sex and age and the random effect subject ID were computed.For accelerometer-determined episodes, normal distribution was confirmed for HR, SDNN, RMSSD, HRVi, LF nu , and HF nu (supplementary figure 1).The variables raw power describing VLF, LF, and HF did not present zeros and were therefore log-transformed to achieve Gaussian distribution (supplementary figure 2), and exponentiated estimates and confidence intervals for log-transformed variables were reported.For pNN50, describing a percentage, a generalised linear mixed-effects model with binomial probability distribution function and identity link was employed.
Significant differences across accelerometer-determined positions were observed for most HRV outcomes (table 3).Compared to seated position, mean differences (95% confidence interval) in RMSSD in standing and lying position (awake) were −2.69 ms (−3.31, −2.06) and 2.73 ms (2.23, 3.23), respectively.At an ICC of 0.59, the RMSSD model presented the lowest inter-individual variance and moderate reliability as compared to other models (Koo and Li 2016).While ICCs for alternative HRV markers were lower, significant differences across activities were observed for most outcomes.However, when comparing raw power in HRVi in sitting and lying position, VLF in sitting, standing, and lying position, and LF in the sitting and standing position, mean differences (95% CI) were not statistically significant at −0.12 (−0.27, 0.03), 1.01 (0.98, 1.04) and 1.02 (0.99, 1.04), and 1.01 (0.98, 1.04), respectively (table 3).In the linear mixed models, male sex was associated with significantly higher mean VLF and LF power, as well as higher LFnu and lower HFnu.Moreover, age was a significant predictor of pNN50, HRVi, and mean LF and HF power.

HRV across sleep status
By classifying episodes into sleep and awake status using self-report journals, mean differences in lying HRV across sleep status were examined.Mean estimates (SD) for RMSSD in individual episodes (6516 episodes) for female and male participants (table 2) were comparable to mean estimates (SD) for total and normalized sleep intervals (supplementary table 1).There were significant differences in lying HRV across self-reported sleep status presenting as increased time-analysis HRV estimates, raw VLF, LF, HF power, and HF nu , and decreased HR and LF nu when individuals were asleep (ICC: 0.40-0.68)(table 4).Male sex was significantly associated with higher SDNN, VLF and LF power, LF nu , and lower HF nu in the linear mixed models for sleep status.

Current practice 24 h HRV summary compared to sleep intervals
When comparing HRV in sleep intervals to 24 h current clinical practice estimates, significant differences were determined for all variables.Mean estimates in linear mixed models for HR, SDNN, HRVi, and LF nu were significantly lower in sleep intervals compared to 24 h assessments, and other HRV markers were significantly higher (table 5).While estimates for mean differences between 24 h estimates and total sleep were commonly close to results for normalized sleep (0:00-05:00), differences in SDNN varied between sleep intervals with mean differences (95%

Continuous assessment of HRV and accelerometry
For person-days with an episode count >50, dayplots presenting continuous RMSSD estimates in accelerometry-determined episodes, 24 h and total sleep RMSSD estimates, and self-reported waking and bedtime were graphed.The 24 h intervals included were initiated at self-reported wake-up time to ensure similar conditions across participants.Upon visual inspection of continuous HRV assessments, trends in RMSSD across daytime and activity were identified.There were some plots where 24 h summary measures and/or sleep summaries visibly deviated from RMSSD during activity episodes.It was confirmed that this was not due to measurement errors by manually checking all graphed person-days.
In figure 1, an example of continuous HRV episodes by daytime, activity, and duration is presented for a parent pair household participating in the study.Data was selected based on complete sleep data, sufficient episode count, and shared wake-up time (i.e.24 h summary initiation time point) as well as household.The couple selected included a 39 year old male and a 37 year old female, and data was recorded on measurement day 2 (SCREENS baseline assessments).In comparison, the female individual presented an overall higher RMSSD than the male.This is visible both in episodes and the summary measures.In both participants, HRV was visibly increased during sleep compared to RMSSD recorded in wake states, whereas the increase was stronger in the male participant.Total sleep and 24 h summary RMSSD were determined at 41.07 ms and 29.75 ms for the male, and 50.74 ms and 46.24 ms for the female, respectively.RMSSD was lowest when individuals were standing, and it increased in sitting and lying position.Mean RMSSD in sitting, standing, and lying episodes was 45.98, 39.64, and 53.03 ms in the female and 22.73, 21.34, and 38.89 ms in the male participant, respectively.While some activity episodes present an RMSSD estimate close to the 24 h summary measure, others deviate widely.Differences in HRV across the activities sitting, standing, and lying were investigated using simple or generalised linear mixed-effects modelling adjusted for age and sex (fixed effects) with subject ID as random effect.Sitting was used as reference.Intraclass correlation coefficients (ICC) are reported to estimate overall reliability across the model.ICC for pNN50 could not be computed.* Outcomes were log transformed and coefficients exponentiated to give ratios of geometric means and expressed in percentage.(i.e. the HF (power) was 18% lower and 12% higher for standing and lying (awake) as compared to sitting, respectively).|Differences in HRV across the 24 h-assessments and self-reported were investigated using investigated using simple or generalised linear mixed-effects modelling adjusted for age and sex (fixed effects) with subject ID as random effect.Sleep was normalized by only analysing 5 h-intervals between 0:00-5:00 to adjust for different sleep routines and sleep stages.Intraclass correlation coefficients (ICC) are reported to estimate overall reliability across the model.ICC for pNN50 could not be computed.* Outcomes were log transformed and coefficients exponentiated to give ratios of geometric means and expressed in percentage.(i.e. the HF (power) was 18% lower and 12% higher for standing and lying (awake) as compared to sitting, respectively

Sensitivity analysis
The effect of removing the first and last 30 s of ECG data from each episode to account for immediate changes in HRV due to changes in position was examined in 30 730 episodes.In a repeated-measures Bland-Altman analysis, RMSSD estimates for activity episodes with adjusted duration were compared to raw episodes (+60 s) and a mean bias (95% LoA) of −0.17 ms (−7.45, 7.11) was found (figure 2).Within subject variation was 13.34 ms, whereas the variance of subject and method interaction and variances of differences were estimated to 0.45 ms and 13.79 ms, respectively.Furthermore, a mixed-effects model for differences across cut and uncut episodes and episode duration with the random effect of subject ID did not suggest statistically significant differences in method agreement across durations of HRV episodes (p = 0.124).
Lastly, ICCs indicating intra-individual variance within unique positions, sleep states, and measurement Example of continuous HRV episodes by daytime, activity, and duration.Example of a continuous HRV assessment in a parent couple on the same recording day using accelerometer-determined classifications of the positions sitting (purple), standing (turquoise), and lying (yellow).Dots represent HRV assessments >5 min and corresponding horizontal lines represent episode duration.Self-reported sleep is marked in grey, and summary RMSSD for sleep (dotted grey line) and 24 h assessment (dashed black line) was computed according to current clinical practice.24 h intervals were initiated at the self-reported wake-up time, which was shared in the two individuals.Two self-reported wake-up times and one bedtime are shown on the x-axis representing continuous time.The RMSSD (ms) is one of the most robust HRV biomarkers.Differences in HRV across position and summary measures are visible.| Abbreviations: RMSSD-root mean square of successive differences; ms-milliseconds; N-night.intervals are presented in table 6.Briefly, HRV recorded in sitting and lying position presented higher ICCs than HRV recorded in standing position.Moreover, outcomes of frequency-analyses were more reliable than time-analysis outcomes in 24 h, total sleep, and normalized sleep intervals.

Interpretation of results
In this study, we combined accelerometry data with HR measurements obtained from single-lead ECG recordings and described significant differences in HRV across position and sleep in 160 adults.While a previous study in animals proposed to adjust models examining HRV for accelerometry-derived energy-expenditure (Oishi et al 2018), we employed an accelerometry-based algorithm to categorise episodes of HRV measurements into positions (sitting, standing, lying).Our results demonstrate that most time-domain and frequency-domain HRV measurements significantly differ across various physical positions, including sitting, standing, and lying (awake) as well as sleep.These observations may be explained by a variety of physiological mechanisms which differ across positions and sleep status.Briefly, hemodynamic changes affect signalling to cardiac baroreceptors resulting in a change in heart rate and consequently cardiac output (Frey et al 1994).Moreover, breathing patterns are affected by posture-dependent breathing styles and respiratory movements, including abdominal and rib cage movements, which differ in supine and upright positions (Lumb and Nunn 1991).Differences in HRV across sleep status are likely due to high vagal activity with relatively low sympathetic tone (Loewy and Spyer 1990), as well as reduced movement and arousal in combination with a more regular respiratory sinus arrhythmia (Brandenberger et al 2005).RMSSD was the most reliable marker of HRV across the included behaviours.Briefly, RMSSD was suppressed when participants were standing compared to sitting and lying positions.Moreover, RMSSD was elevated in lying position when individuals were asleep compared to awake.This highlights that sleep recording is a crucial data source for HRV analysis in free-living settings to account for the reported differences.
In contrast, VLF and LF power did not significantly differ across sitting and standing positions, and HRVi and VLF power were not significantly different across sitting and lying positions, respectively.Briefly, the prevailing effects of vagal activity and respiration on frequency-related outcomes of HRV and HRVi may overshadow postural effects (Shaffer and Ginsberg 2017).This may also explain why differences in VLF, LF, and HF could be observed across sleep status as respiratory sinus arrhythmia is stabilised during sleep (Brandenberger et al 2005).Furthermore, while VLF and LF power are appropriate to analyse in 5 min episodes, VLF has been suggested to be best monitored in 24 h recordings (Shaffer and Ginsberg 2017).Finally, thermoregulation, the renin-angiotensin system, endothelial effects, or baroreceptor activity may additionally play a role when discussing short-term VLF, LF, and HRVi recordings (Shaffer and Ginsberg 2017).Furthermore, differences in HRV between standard practice 24 h-and sleep-summary measures were examined, and results suggest notable differences and poor agreement of total sleep HRV with 24 h-estimates.However, there was a small mean difference and high agreement in HRV measures between total sleep and normalised sleep (0:00-5:00).This may imply that episodes of night-time HR recordings >5 h may be comparable to HRV assessed during the total sleep duration.This may facilitate data analysis for participants with missing data due to the detachment of electrodes, which often occurs during sleep.
In assessing the reliability of HRV measurements within individuals, the ICC values reported highlight a poor to good reliability ranging from 0.31 to 0.88.Some of the ICC estimates suggest that while individual-specific factors contribute significantly to the variability in HRV, there is also a notable stability within individuals over time, particularly for RMSSD, indicating a strong individual physiological signature in HRV.Nevertheless, the variability indicated by the lower ICC values for certain indices in episodes of position or sleep, such as SDNN, HRVi, and VLF, underscores the dynamic nature of autonomic regulation and its sensitivity to situational factors.Interestingly, the reliability of RMSSD across episodes recorded in sitting position (0.63) and lying position (0.67) is similar to the ICC computed for RMSSD recorded 24 h-measurements of HRV (0.70).For frequency outcomes, the highest reliability was computed in longer intervals (24 h, total sleep, normalized sleep).
While summary measures of HRV (24 h, sleep) are current standard practice in free-living research and clinical assessments (Shaffer and Ginsberg 2017), continuous plots of HRV episodes showed some deviation of episode-assessed HRV from summary measures across positions.Especially when examining the effect of an intervention on HRV, we hypothesize that summary measures may therefore dilute intervention effects on HRV during specific behaviours, such as periods of relaxation (sedentary).

Methodological considerations
Removing the first and last 30 s of HRV recordings within episodes was determined to be a successful strategy to account for immediate changes in HRV due to posture changes.Importantly, adjustments for immediate changes in position may be required, because orthostatic effects on the autonomic nervous system may reduce the accuracy of short-term HRV estimations in different positions (Wang et al 2022).In a linear mixed model, differences across cut and uncut episodes were also not shown to be associated with episode duration.Therefore, we suggest that our strategy is equally effective at accounting for orthostatic effects in episodes ∼5 min duration and hour-long periods of unchanged position or behaviour.
Overall, the approach of adding accelerometry-determined episodes of position to estimate HRV was highlighted to be a cost-effective and transparent methodology for ambulatory research.Our approach, which allows for precise adjustments based on specific behaviours may provide an enhanced general measure of the autonomic nervous system compared to standard 24 h HRV assessments.This could be particularly valuable in experimental studies that include ambulatory activities, such as exercise.Furthermore, standardised methodologies for heart rate signal processing, filtering, and data handling are warranted to promote reproducibility and transparency in the HRV research field.When commercial software is used, proprietary algorithms for data cleaning may limit reproducibility using other methodologies (Fuller et al 2020).In our study, we employed the freely available RHRV package to interpolate, filter, and analyse heart rate data (Martinez et al 2017).While some functions needed to be added to the official package and some small modifications were made to increase the speed of data analysis, available code, a tutorial, and open-source software allow other researchers to use our approach in a standardised format (Link: https://github.com/marleriee/RHRV_SDU).

Limitations
Some limitations of this study should be discussed.Although the sample size of 160 participants provided large amounts of data, the rather narrow age range of 31-58 years reduces generalisability to young people and older adults.As the SCREENS trial required high screen media use in addition to living in a family with children at baseline, HRV within the sample may be affected by inclusion criteria.However, the intervention is unlikely to affect differences in HRV between positions.While data processing followed standard recommendations (Task Force of the European Society of Cardiology and the North American Society of Pacing and Electrophysiology 1996, Martinez et al 2017), protocols may differ from commonly employed commercial processing applications, such as Kubios (Tarvainen et al 2014).When examining differences in HRV across position and sleep, mixed-effects models were adjusted for age and sex.However, in free-living environments, these analyses may also be at risk of confounding by other factors, such as psychosocial factors, smoking, and the consumption of alcohol and caffeinated beverages (Tegegne et al 2018).Yet, having repeated assessment of HRV across numerous episode classifications within subjects tends to increase the robustness of findings against potential confounding.As sleep was self-reported, it may also be affected by social desirability bias and recall bias.Therefore, some episodes which are classified as 'sleeping' may describe 'awake' behaviours that were misreported to conceal adverse sleep habits.However, a recent publication (Zorko et al 2020) has developed a methodology for simple sleep detection using markers of respiratory sinus arrhythmia in heart rate recordings, and similar approaches may be introduced to analysis protocols for real-time sleep detection during ambulatory HRV assessments in the future.Furthermore, HRV was estimated for episodes of different durations as accelerometry measurements directed the analyses.While this may be seen as a limitation when comparing results to findings from studies employing standard 5 min short-term HRV estimates, we suggest that ensuring the longest possible stable measurement of HRV promotes more accurate results.

Future outlook
By establishing a protocol for HRV analysis in free-living settings based on 24 h data, we hope to offer potential enhancements in the accuracy of HRV measurements, particularly relevant when assessing the impact of interventions (in experimental studies) or exposures (in observational studies) that include ambulatory activities, such as exercise.In detail, we introduced a simple, transparent, and open-source protocol for the analysis of ambulatory HRV across episode classifications by processing accelerometry and HR files in R and employing RHRV for automated time-and frequency-analysis of HRV.Briefly, accelerometry and HR data are obtained simultaneously, accelerometry data is categorised into episodes of physical behaviours using an algorithm (Skotte et al 2014), and HR is analysed by these episodes in RHRV to estimate markers of HRV.While several of the functions used for the analysis are not yet included in the RHRV package, we supply a modified version of RHRV.Guided by detailed recommendations for the analysis of HRV in RHRV (Martinez et al 2017), we hereby aim to facilitate HRV analysis in free-living settings.One potential application for our proposed methodology is research aiming to quantify autonomic stress in non-stationary conditions.As power spectral analysis requires stable condition across the measurement period (Spellenberg et al 2020), extracting episodes in unique behaviours would potentially account for changes in hemodynamic and task-related physiological requirements.As accelerometry and ECG or photoplethysmography are widely accessible, this methodology may reduce the need for more advanced and costly commercial wearables in open-field research.

Conclusion
Ambulatory HRV in healthy adults was shown to significantly differ across position and sleep status.Moreover, HRV across the total sleep duration was in poor agreement with 24 h-summary measures.These findings have notable implications for the assessment of general autonomic activity in free-living situations using 24 h HRV.It emphasises the necessity to consider the impact of different physical behaviours and sleep status when interpreting 24 h HRV data, particularly in the context of a study examining the effects of engagement in activities in free-living.Lastly, this analysis was concluded by proposing a simple, transparent approach for the analysis of HRV in accelerometer-defined episodes employing open-source methodology in RHRV.
Abbreviations: HR-heart rate (beats min −1 ); Figure 1.Example of continuous HRV episodes by daytime, activity, and duration.Example of a continuous HRV assessment in a parent couple on the same recording day using accelerometer-determined classifications of the

Figure 2 .
Figure 2. Bland-Altman plot comparing HRV estimates for episodes adjusted for immediate change in posture to raw estimates.Bland-Altman scatterplot presenting mean and difference between adjusted episodes and raw episodes (+60 s) for each datapoint included in the agreement analysis (n = 30 730) including 95% LoA (±1.96SD).| Abbreviations: RMSSD-root mean square of successive differences; ms-milliseconds; LoA-limits of agreement.

Table 2 .
Time-and frequency results of heart rate variability across accelerometer-determined activities.Heart rate variability (HRV) by sex and accelerometer-determined activity is presented as mean [standard deviation (SD)] for normally distributed variables and median [IQR (Q3-Q1] for non-normally distributed variables ( *

Table 3 .
Linear mixed model for daily habitual physical behaviours.

Table 4 .
Linear mixed model for lying physical behaviour during awake and asleep status.Differences in lying HRV across sleep status were investigated using simple or generalised linear mixed-effects modelling adjusted for age and sex (fixed effects) with subject ID as random effect.Awake status was used as reference.Intraclass correlation coefficients (ICC) are reported to estimate overall reliability across the model.ICC for pNN50 not be computed.* Outcomes were log transformed and coefficients exponentiated to give ratios of geometric means and expressed in percentage.(i.e. the HF (power) was 18% lower and 12% higher for standing and lying (awake) as compared to sitting, respectively).

Table 5 .
Linear mixed model for full-day assessments compared to selected sleep intervals.

Table 6 .
Intraclass correlation coefficients across activities and intervals.Intervals ICC Sitting ICC Standing ICC Lying ICC Awake ICC Asleep ICC 24h ICC Total Sleep ICC Normalized SleepInterclass correlation coefficients (ICC) for each unique position, sleep state, or measurement interval were calculated based on the estimated within-subject and between-subject variance in the respective HRV measure obtained from the linear mixed models including all available respective episodes across subjects.Higher ICC values suggest greater consistency of HRV measures within individuals in the respective body position, state, or interval, while lower ICC values indicate more episodic variability and thus less individual PositionSleep status (Lying)