Full text
46,599 characters
· extracted from
preprint-html
· click to expand
Estimating the sleep period time window based on a hip-worn accelerometer collected in children and adults | medRxiv /* */ /* */ <!-- <!-- /*! * yepnope1.5.4 * (c) WTFPL, GPLv2 */ (function(a,b,c){function d(a){return"[object Function]"==o.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&&(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return"[object Array]"==o.call(a)},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f<d;f++)g=a[f].split("="),(e=z[g.shift()])&&(c=e(c,g));for(f=0;f<b;f++)c=x[f](c);return c}function g(a,e,f,g,h){var i=b(a),j=i.autoCallback;i.url.split(".").pop().split("?").shift(),i.bypass||(e&&(e=d(e)?e:e[a]||e[g]||e[a.split("/").pop().split("?")[0]]),i.instead?i.instead(a,e,f,g,h):(y[i.url]?i.noexec=!0:y[i.url]=1,f.load(i.url,i.forceCSS||!i.forceJS&&"css"==i.url.split(".").pop().split("?").shift()?"c":c,i.noexec,i.attrs,i.timeout),(d(e)||d(j))&&f.load(function(){k(),e&&e(i.origUrl,h,g),j&&j(i.origUrl,h,g),y[i.url]=2})))}function h(a,b){function c(a,c){if(a){if(e(a))c||(j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}),g(a,j,b,0,h);else if(Object(a)===a)for(n in m=function(){var b=0,c;for(c in a)a.hasOwnProperty(c)&&b++;return b}(),a)a.hasOwnProperty(n)&&(!c&&!--m&&(d(j)?j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}:j[n]=function(a){return function(){var b=[].slice.call(arguments);a&&a.apply(this,b),l()}}(k[n])),g(a[n],j,b,n,h))}else!c&&l()}var h=!!a.test,i=a.load||a.both,j=a.callback||f,k=j,l=a.complete||f,m,n;c(h?a.yep:a.nope,!!i),i&&c(i)}var i,j,l=this.yepnope.loader;if(e(a))g(a,0,l,0);else if(w(a))for(i=0;i (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0];var j=d.createElement(s);var dl=l!='dataLayer'?'&l='+l:'';j.src='//www.googletagmanager.com/gtm.js?id='+i+dl;j.type='text/javascript';j.async=true;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','GTM-P4HH5NV'); Skip to main content Home About Submit ALERTS / RSS Search for this keyword Advanced Search Estimating the sleep period time window based on a hip-worn accelerometer collected in children and adults View ORCID Profile Jairo H Migueles , Vincent T van Hees , Michael J Stein , Michael F Leitzmann , Hansjoerg Baurecht , View ORCID Profile Claas Lendt doi: https://doi.org/10.1101/2025.11.25.25340956 Jairo H Migueles 1 Department of Physical Education and Sports, Faculty of Sport Sciences, Sport and Health University Research Institute (iMUDS), University of Granada , Granada, Spain 2 Department of Global Public Health, Karolinska Institutet , Stockholm, Sweden Find this author on Google Scholar Find this author on PubMed Search for this author on this site ORCID record for Jairo H Migueles For correspondence: jairohm{at}ugr.es Vincent T van Hees 3 Accelting , Almere, The Netherlands Find this author on Google Scholar Find this author on PubMed Search for this author on this site Michael J Stein 4 Department of Epidemiology and Preventive Medicine, University of Regensburg , Regensburg, Germany Find this author on Google Scholar Find this author on PubMed Search for this author on this site Michael F Leitzmann 4 Department of Epidemiology and Preventive Medicine, University of Regensburg , Regensburg, Germany Find this author on Google Scholar Find this author on PubMed Search for this author on this site Hansjoerg Baurecht 4 Department of Epidemiology and Preventive Medicine, University of Regensburg , Regensburg, Germany Find this author on Google Scholar Find this author on PubMed Search for this author on this site Claas Lendt 4 Department of Epidemiology and Preventive Medicine, University of Regensburg , Regensburg, Germany 5 Sports Performance Research Institute New Zealand, School of Sport and Recreation, Auckland University of Technology , New Zealand Find this author on Google Scholar Find this author on PubMed Search for this author on this site ORCID record for Claas Lendt Abstract Full Text Info/History Metrics Supplementary material Data/Code Preview PDF Abstract Background Accurately detecting the Sleep Period Time (SPT) window in the daily life is essential for understanding habitual sleep and health. Although actigraphy devices (accelerometers) placement varies across studies, most SPT-detection algorithms are developed for wrist data. Open-source algorithms support reproducibility and transparency in estimating the SPT. Aims To optimise and evaluate two open-source algorithms, HDCZA and HorAngle, for estimating the SPT window using hip-worn accelerometer data. Methods A total of 109 children and 194 adults wore wrist and hip accelerometers for six nights and completed sleep diaries. An established algorithm combining wrist and diary data served as the reference. HDCZA and HorAngle parameters were optimised using Bayesian optimisation on 60% of the sample and evaluated in the remaining 40%. Results Mean differences for sleep onset and wake-up were –3 and 4 minutes for HDCZA (limits of agreement [LoA]: −221,215 and −185,194; root-mean square error [RMSE]=111 and 97) and 0 and −4 minutes for HorAngle (LoA: −199,199 and −223,214; RMSE=111 and 112). For SPT duration, mean differences were 7 minutes (LoA: −252,266; RMSE=132) for HDCZA and −4 minutes (LoA: −254,246; RMSE=128). No significant differences in SPT duration were found (P=0.774; P=0.237). Both algorithms showed moderate agreement with the reference in ranking sleep duration (κ ≈ 0.56−0.58). Differences were unrelated to age or sex but linked to non-wear time. Conclusions Both open-source algorithms demonstrated value for estimating the SPT window from hip data. While HDCZA requires no additional sensor-specific parameters, HorAngle depends on accurate axis identification. Statement of Significance Accurately estimating the sleep period time (SPT) window from hip-worn accelerometers is essential for studies assessing sleep in free-living conditions. However, most available algorithms were developed for wrist-worn data. This study optimised and validated two open-source algorithms, HDCZA and HorAngle, for hip-worn accelerometer data in children and adults. Both algorithms performed comparably to a wrist-based reference using sleep diaries, showing consistent agreement across age and sex. These methods enable researchers to estimate habitual sleep without additional sensors or diaries, improving reproducibility and scalability in observational research. The algorithms are openly implemented in the GGIR R package, offering accessible and standardised tools for analysing hip-based accelerometer data. Introduction The sleep period time (SPT) window refers to the time between sleep onset and the end of sleep. 1 This period is a key metric for studying sleep in both clinical and population-based studies. Major health organisations, including the American Academy of Sleep Medicine and the World Health Organisation, base their sleep duration recommendations on the SPT window. 2 – 4 Wrist-worn actigraphy is widely used for estimating the SPT window in the daily life of study participants. 5 However, a number of population-based cohorts have adopted hip-worn accelerometers for 24-hour activity monitoring. Examples include as NAKO (Germany), 6 Tromsø (Norway), 7 ELSA (Brazil), 8 Raine (Australia), 9 and OPACH (United States), 10 with a combined sample size of >85,000 participants with valid accelerometer data across a wide age range. All these studies store unprocessed ‘raw’ acceleration values in gravitational units, as opposed to pre-processed ‘count’ values. Further, most of these studies did not employ a sleep diary, which necessitates relying solely on actigraphy to detect the SPT window. The advantages of raw value collection are increased analytical freedom and the ability to re-use algorithms across sensor brands. This form of actigraphy is commonly referred to as accelerometry in reference to the acceleration sensor. No algorithms have been reported in the literature for classifying the SPT window from raw hip-worn accelerometer data. However, open-source R package GGIR as widely used for wrist-worn accelerometer data offers two algorithms that have not been optimized and evaluated yet for data from the hip. In order to optimize and evaluate algorithms for accelerometer data a reference method is needed that can consider the full 24 hour window. 11 Although polysomnography (PSG) is the gold standard for classifying sleep, it is not feasible to be worn continuously over a measurement period of multiple hours or days. As a result, whether short naps near nighttime, such as an evening nap in front of the television, are included in the main sleep period depends on when participants choose to wear the PSG, rather than on a standardized methodology. Instead, a method based on wrist-worn accelerometer data, guided by a sleep diary, offers a reference method that captures 24-hour sleep-wake patterns over multiple days, something not feasible with PSG. In this study, we aimed to optimise and evaluate two existing algorithms 12 for hip-worn accelerometer data in children and adults by using a reference method that detects SPT window based on wrist-accelerometer data guided by sleep diary. Methods Study Population The data for this study were derived from the baseline assessments of two clinical trials: ActiveBrains 13 and ACTIBATE trials. 14 The ActiveBrains trial included 109 children (41% girls) aged 8−12 years with overweight or obesity, while the ACTIBATE trial enrolled 194 sedentary, healthy, young adults (65% women) aged 18−35 years. The data were split into an optimization and a test set by taking a random subset of 60% and 40% from each cohort (n = 181 and n = 122, respectively). Written informed consent was obtained from all participants in the ACTIBATE trial and from the parents or legal guardians of the children in ActiveBrains. Both trials were approved by the Ethics Committee of the University of Granada and were registered at ClinicalTrials.gov (ActiveBrains: NCT02295072 ; ACTIBATE: NCT02365129 ). Data collection and pre-processing In both studies, participants were instructed to wear two ActiGraph GT3X+ accelerometers (ActiGraph, Pensacola, Florida, US) simultaneously for seven consecutive days and six nights, one on their right hip and one on their non-dominant wrist. Throughout the monitoring period, participants were instructed to maintain a sleep diary, recording their sleep onset and wake-up times. All accelerometers were configured to collect data at a 100 Hz sampling frequency, with the ActiGraph’s idle sleep mode disabled. The raw acceleration data were downloaded via the ActiLife v6.13.3 software (ActiGraph, Pensacola, Florida) into .gt3x files and processed using the open-source R package GGIR v3.2-7. 12 We applied the default GGIR data pre-processing steps, including: (i) auto-calibration of the raw accelerations; (ii) detection of non-wear time; (iii) estimation of the angles of each accelerometer’s axis relative to the horizontal plane per 5-second epoch. After processing, the GGIR sleep output data were filtered to retain only nights for which sleep diaries were available. Additionally, nights for which more than one-third of the sleep window was marked as invalid (e.g., non-wear time) in either the wrist or hip data were excluded from all analyses. Sleep Period Time window estimation The estimation of the SPT window in GGIR is estimated in three stages: Detection of rest periods, which in GGIR are referred to as Sustained Inactivity Bouts (SIB). For this, we used the algorithm proposed by van Hees et al. (2015), 15 which identifies periods of ‘timethreshold’ minutes in which the angle of the z-axis does not change by more than ‘anglethreshold’ degrees. Identification of time windows that guide the eventual sleep detection, referred to as guider window. The methods used to define the guider window are referred to as ‘guiders’. The following guiders are used in this study: Sleep log: Sleep onset and wake-up time as reported by study participants in their sleep diary. HDCZA: This algorithm was designed for studies with wrist-worn accelerometer data in which no sleep log is available. 1 The algorithm consists of nine steps as discussed elsewhere. 1 In short, steps 1-6 attempt to classify time periods with limited change in the angle of the accelerometer’s z-axis. In the present study we have simplified step 6 with a single threshold represented by GGIR parameter ‘HDCZA_threshold’. Next, step 7 extracts rest blocks longer than the number of minues specified with parameter ‘spt_min_block’. Step 8 merges rest blocks separated by gaps shorter than the number of minutes specified with parameter ‘spt_max_gap_dur’ and with gap/rest ratio lower than the ratio specified with parameter ‘spt_max_gap_ratio’. Step 9 looks for the longest resulting rest block in the day, which represents the guider window. HorAngle: This represents a new algorithm designed for hip-worn accelerometer data. The algorithm searches for the longest period during which the longitudinal axis of the accelerometer is horizontal, which is used as a proxy for a horizontal orientation of the trunk. For this, we specified parameter ‘longitudinal_axis = 2’ to indicate that for the ActiGraph brand the second axis represents the longitudinal axis. The algorithm then identifies when this axis is horizontal, i.e., when it is between - X and + X degrees, where X is specified with parameter ‘HorAngle_threshold’. Finally, the algorithm uses the classified periods of being horizontal as input for the same final 3 steps (steps 7 to 9) as the HDCZA algorithm to find the main window to act as guider. Identification of the overlap between the windows identified in steps 1 and 2 to define the SPT window. Briefly, SIBs overlapping with the guider window are considered to be part of the SPT, with the first and last overlapping SIBs indicating the sleep onset and wake-up times. As our aim is to optimise the estimation of the SPT-window rather than the SIBs, we configured GGIR to treat the guider window as the final estimate for SPT (i.e., with GGIR parameters anglethreshold = 100, timethreshold = 1, ignorenonwear = FALSE, relyonguider = TRUE). All parameter definitions can be found in Table 1 . View this table: View inline View popup Download powerpoint Table 1: Definition of parameters, configuration in the referent method (wrist accelerometers guided by sleep logs) and parameters’ bounds used for the optimisation of the SPT estimation algorithms. Parameter optimisation Wrist accelerometer data guided by sleep diaries were used as reference method as this approach has previously been demonstrated to provide acceptable validity 1 and combines the strengths of both sleep log and wrist accelerometry. 15 . The performance metric used during optimisation was the average root mean square error (RMSE) between the estimated sleep onset and wake-up times provided by the algorithm and the reference values. Optimisation procedure The full data set was split into a training set (n = 181, 60%) and a test set (n = 122, 40%), ensuring proportional representation from the ActiveBrains and the ACTIBATE studies. First, we used the training set to compare two combinations of search ranges for the ‘HDCZA_threshold’ parameter as used by the HDCZA algorithm in a 3-fold cross-validation in the full training set (fold size was 1/3 of the training set), see Table 1 . This was done to narrow the search space and to reduce the risk of overfitting. To identify the most robust set of parameter ranges we used the product of the mean RMSE and standard deviation of the RMSE across folds as a selection criterion to balance both average performance and stability across data splits. Next, the most robust set of search ranges were used for the final optimisation. The parameters for both HDCZA and HorAngle were then optimised in the full training set and the test set was used for the final evaluation of model performance. Here, the parameters were optimised using the “ParBayesianOptimization” R package for Bayesian optimisation. 16 This was configured to use 8 initial points and 20 iterations for the cross-validation as used for HDCZA and 10 initial points and 50 iterations for training the final model as used for both algorithms. Further, the expected improvement acquisition function was selected to guide the optimisation. The search space for each algorithm parameter can be found in Table 1 . Statistics Participant characteristics were summarised using means and standard deviations. We evaluated the performance of two algorithms, HDCZA and HorAngle, using their respective optimised parameters. Algorithm performance was evaluated as follows. First, agreement of the algorithms with the reference values was assessed through Bland–Altman plots and the RMSE. To explore the shape of the distribution, we quantified the proportion of nights with absolute errors exceeding 0.5, 1, 2, and 5 hours. In addition, we investigated potential sources of error by fitting linear mixed-effects models, with estimation errors (for sleep onset and wake-up time) as dependent variables. The fixed effects included age group, sex, day type (weekday or weekend), and levels of non-wear time in hip or wrist accelerometer data. Participant ID was modeled as a random intercept to account for repeated measures. These models were fitted using the lmer function from the lmerTest R package. 17 To evaluate whether the algorithms preserved the relative ranking of individuals by SPT window duration, we categorized reference and estimated SPT durations into quintiles and calculated squared-weighted Cohen’s kappa with corresponding confusion matrices. To assess the added value of optimisation, we also evaluated the HDCZA algorithm using the default settings as implemented in GGIR, which were originally designed for wrist-worn accelerometer data. Results The study included a total of 303 participants, comprising 109 children (mean age: 10.0 [SD=1.1] years; 44 girls) and 194 adults (mean age: 22.1 [SD=2.2] years; 124 women). Parameter optimisation and cross-validation HDCZA algorithm The results from the 3-fold nested cross-validation for the exploration of the appropriate search space for such algorithm are presented in Table S1 (Supplement). The second bound set resulted in a lower mean × standard deviation of RMSE (0.093 vs. 0.060). Therefore, it was selected for the final optimisation of the HDCZA algorithm using the full training set. The Bayesian optimisation of the HDCZA algorithm resulted in the following optimal parameter values: HDCZA_threshold = 0.259, spt_min_block_dur = 34, spt_max_gap_dur = 52, and spt_max_gap_ratio = 0.282, see Figure 1 . Download figure Open in new tab Figure 1: Optimisation output of parameters for the HDCZA algorithm. Star indicates the optimized value. HorAngle algorithm The Bayesian optimization of the HorAngle algorithm resulted in the following optimal parameter values: HorAngle_threshold = 58, spt_min_block_dur = 60, spt_max_gap_dur = 20, and spt_max_gap_ratio = 0.034, see Figure 2 . Download figure Open in new tab Figure 2: Optimisation output of parameters for the HorAngle algorithm. Star indicates the optimized value. Evaluation of the algorithms For sleep onset, the HDCZA showed a mean difference of −3 minutes ( P = 0.741) with limits of agreement (LoA) from −221 to 215 minutes, and with a RMSE of 111.1. The HorAngle algorithm performed similarly, with a mean difference of 0 minutes (LoA: −199 to 199 minutes, P = 0.967), and RMSE of 101.4, see top row of Figure 3 . Download figure Open in new tab Figure 3: Bland Altman plots for the comparison of algorithm-estimated sleep onset time, wake-up time, and SPT with reference values (ref). For wake-up time, the optimised HDCZA showed a mean difference of 4 minutes (LoA: −185 to 194, P = 0.537), and a RMSE of 96.7. The HorAngle showed a similar performance (−4 minutes; LoA: −223 to 214; P = 0.536; RMSE = 111.5), see middle row of Figure 3 . In terms of SPT window duration, the HDCZA yielded a mean difference of 7 minutes (LoA: −252 to 266; P = 0.324; RMSE = 132.4), while the HorAngle algorithm showed comparable results (-− minutes; LoA: −254 to 246; P = 0.557; RMSE = 127.6), see bottom row of Figure 3 . The HDCZA and HorAngle algorithms both resulted in a similar proportion of nights falling within the lowest error threshold (<60 minutes), 72.3% and 74.4% respectively, Table 2 . Classification of participants into quintiles of SPT duration showed moderate agreement with the reference (weighted κ = 0.56 for HDCZA and 0.58 for HorAngle, p < 0.001), with most misclassifications occurring between adjacent quintiles, see Table S2 and Table S3 in the Supplement. View this table: View inline View popup Download powerpoint Table 2: Distribution of nights classified by the error committed by each algorithm in the detection of sleep onset and wake-up times. Examples of SPT window estimates from the HDCZA and the HorAngle algorithms can be found in the Supplementary Material (Figures S1 to S3). Effect of potential confounders on the performance of the algorithms For sleep onset, none of the covariates were significantly associated with differences between reference method and the HDCZA estimate, see Supplementary Table S4. However, in the HorAngle model, the presence of a non-wear mismatch (i.e., non-wear detected on only one device) was associated with a significantly earlier onset estimate (β = −0.740, P = 0.002), indicating potential sensitivity to inconsistent device wear time, see Supplementary Table S4. For wake-up time, several variables were significantly associated with differences between the reference method and the HDCZA estimates, including: Child age group (β = −0.366, P = 0.016), female sex (β = −0.419, P = 0.003), hip non-wear (moderate) (β = −0.848, P = 0.011), and hip non-wear (high) (β = −1.698, P = <0.001). In contrast, for HorAngle only wrist non-wear showed a significant association (β = −1.337, P = 0.017), see Supplementary Table S4. Secondary analysis: default HDCZA performance In a secondary analysis, we evaluated the performance of the default HDCZA to explore the added value of optimisation (Figure S4). For sleep onset, the mean difference was −24 minutes (LoA: −273 to 224), for wake-up time 19 minutes (LoA: −203 to 241), and for SPT duration 43 minutes (LoA: −237 to 323). Discussion This study proposes two candidate algorithms to estimate the SPT window from hip-worn accelerometers as widely used by several large cohort studies around the world. Firstly, we optimised the parameters for the HDCZA algorithm, originally designed for wrist-based data, and we introduced and optimised the HorAngle algorithm, which leverages posture-related information to estimate the SPT window. Both approaches were evaluated against a reference combining wrist-worn accelerometers and sleep diaries, which has demonstrated value in the previous studies. 15 Our findings show similar performance of these two algorithms to estimate the SPT window based on hip accelerometer data, offering valuable alternatives in studies using 24-hour hip accelerometer data monitoring. Although we refer to “sleep” throughout this study, it is important to note that we are not measuring sleep in the physiological or neurological sense. Our methods estimate the SPT window based on movement patterns, not direct indicators of sleep such as those captured via PSG. This distinction is critical, particularly in the context of free-living conditions, where neurological measurements are not feasible and no true gold standard for SPT detection exists. 11 The HorAngle algorithm, which leverages the angle of the longitudinal axis as a proxy for trunk orientation during sleep, performed comparably or slightly better than the optimised HDCZA in some metrics, suggesting it is particularly better suited for hip data. However, a potential limitation is that HorAngle depends on the accurate identification of the accelerometer axis aligned with the body’s longitudinal axis. The intended axis to align with the longitudinal axis of the body is usually specified by the manufactured as the Y axis. However, this may vary across accelerometer brands and, in some studies the orientation of attachment is not properly controlled, for example when participant are instructed to carry the accelerometer in a pocket. Further, body shape and clothing may affect the orientation of the axis Y of the accelerometer relative to the longitudinal axis. The proportion of nights showing large differences from our reference values (>2 hours) was comparable between the HDCZA and HorAngle algorithms. Linear mixed models indicated consistent performance across both children and adults, suggesting that the algorithms are applicable across age groups and sexes. However, these models also identified non-wear time as a source of residual error, which was associated with poorer accuracy in specific models. This highlights the need for further research into effective strategies for handling missing data due to non-wear, including the development of suitable imputation methods. Previous efforts to estimate the SPT window using hip-worn accelerometers have relied primarily on algorithms developed for proprietary activity count data. Some examples include work by Tudor-Locke et al. (2014), 18 Tracy et al. (2014), 19 and McVeigh et al. (2016), 11 which applied rule-based approaches to identify sleep intervals based on thresholds or changes in activity counts. Although the underlying algorithm to derive these activity counts has been published, 20 we chose not to implement these methods in the present analysis for two reasons. First, fair method comparisons require testing in independent datasets rather than re-optimizing or re-applying algorithms on the same data used for their development. Second, we prioritized approaches based on raw accelerometer metrics (e.g., acceleration in gravitational units, posture angles), which are more interpretable and generalizable than abstract count units. Direct numerical comparison with prior findings is also limited by differences in reference standards. The earlier studies evaluated algorithms against visual inspection of accelerometer traces, which carries a risk of correlated errors because the same data source informs both algorithm and reference. By contrast, our study relied on an independent criterion measure, which provides a more robust assessment of validity. More recent applications have further developed, tested, or adapted the algorithms introduced in the previous paragraph 11 , 18 , 19 in diverse populations. 21 – 23 When comparing our results to these previous studies, the performance of our optimized algorithms appears competitive. For instance, the HDCZA algorithm, when applied to hip-worn Actigraph data in children by Meredith-Jones et al., showed a mean difference of −6 (95% CI: −15, 4) minutes for sleep onset, −11 (95% CI: −40, 18) minutes for sleep offset, and 8 (95% CI: −5, 31) minutes for SPT-window duration. 24 For Axivity devices worn on the back, Meredith-Jones et al. 24 reported a mean difference of −21 (95% CI: −37, −5) minutes for sleep onset, −8 (95% CI: −32, 17) minutes for sleep offset, and 14 (95% CI: −8, 35) minutes for SPT-window duration using HDCZA. Likewise, the Count-Scaled (CS) algorithm, when used with Actigraph hip data, showed a mean difference of −12 (95% CI: −20, −4) minutes for sleep onset, 16 (95% CI: 1, 31) minutes for sleep offset, and 28 (95% CI: 13, 43) minutes for SPT duration. With Axivity devices on the back, the CS algorithm reported −20 (95% CI: −28, −13) minutes for sleep onset, 5 (95% CI: −10, 20) minutes for sleep offset, and 25 (95% CI: 10, 41) minutes for SPT duration. Our optimised HDCZA and HorAngle algorithms show better mean differences and CIs for sleep onset (HDCZA: −3 [95% CI: −12, 7]; HorAngle: −0 [95% CI: −9, 8]), wake-up (HDCZA: 4 [95% CI: −4, 13]; HorAngle: −4 [95% CI: −14, 5]), and SPT-window duration (HDCZA: 7 [95% CI: −4, 18]; HorAngle: −4 [95% CI: −15, 7]) compared to these. However, comparisons across studies are often limited due to differences in study design, reference methods, and outcome metrics. Some other implementations have explored machine learning to classify sleep versus wake states, albeit not specifically focused on the SPT window. 25 Although performance was improved significantly with random forests compared with conventional heuristic approaches, this gain often comes at the expense of interpretability. For example, a recent study by Weitz et al. 26 applied a machine learning model to estimate time in bed using hip-worn accelerometers. While this illustrates growing interest in automating sleep-related estimates from hip accelerometer data, it shares similar limitations in terms of interpretability. Moreover, their use of chest-worn data for visual annotation may introduce correlated measurement error with hip-worn devices given that both are attached to the same part of the body, and the rationale for visually defining time in bed is not clearly justified. In contrast, our approach balances interpretability and performance by combining domain-informed parameter structures with data-driven Bayesian optimisation. This enables fine-tuning while retaining transparency and behavioral plausibility in the algorithm. Implications Both the HorAngle and HDCZA algorithms are implemented in the permissively licensed open-source GGIR R package, 12 ensuring compatibility with established GGIR pipelines already used in large epidemiological cohorts (e.g., NAKO, ELSA, Tromsø). This facilitates direct application of our methods within existing workflows and supports replication across diverse datasets. Additionally, the code and materials for the application of the Bayesian optimisation, and all the analyses conducted for the present study are available in an open-source GitHub repository ( https://github.com/jhmigueles/spt_detection_hip ). Our findings have implications for sleep research in epidemiological cohorts using hip-worn accelerometers. As seen in large-scale cohort studies, hip placement is frequently chosen for 24-hour physical activity monitoring, yet existing sleep estimation methods for wrist-worn accelerometer data are suboptimal when applied to such data. This study provides validated, open-source methods that can improve the extraction of sleep metrics without requiring auxiliary information like sleep diaries, thus increasing scalability and reproducibility while decreasing participant burden. Example GGIR function calls using the validated optimised parameters are available in the Supplement. Strengths and Limitations A strength of this study is the evaluation under free-living conditions which come with the challenge that rest period not part of the actual SPT window need to be separated. Furthermore, the use of two age groups (children and young adults) enhances generalisability. We also employed a rigorous optimisation approach involving nested cross-validation and Bayesian methods to prevent overfitting. Importantly, both algorithms evaluated in this study are implemented as open-source tools within the GGIR R package. Limitations include the relatively small and homogeneous sample compared to national cohorts, which may limit applicability to older adults or populations with sleep disorders. Noteworthy, these algorithms infer only the SPT window and do not classify sleep as such; for sleep detection, future research is needed using PSG as reference. Conclusion We identified two candidate algorithms for estimating the SPT window. The novel HorAngle algorithm performed similarly to the HDCZA algorithm, providing a valuable alternative in settings where hip-based monitoring is used. Importantly, while the HDCZA algorithm can be applied directly without sensor-specific configuration, the HorAngle algorithm relies on the assumption that accelerometer is well aligned with the body’s longitudinal axis. Nevertheless, further evaluation of these parameters in independent samples is recommended to confirm generalisability and clinical relevance. Data Availability All data produced in the present study are available upon reasonable request to the authors. Funding The ActiveBrains project was supported with grants DEP2013-47540, DEP2016-79512-R, DEP2017-91544EXP, and RYC-2011-09011 from the Spanish Ministry of Economy and Competitiveness and the European Regional Development Fund and by grant PID2020-120249RB-I00 from the MCIN/AEI/10.13039/501100011033. Additional funding was obtained from the Andalusian Operational Programme supported with grant B-CTS-355UGR18 from the European Regional Development Fund. The ACTIBATE project was supported by the Spanish Ministry of Economy and Competitiveness via Fondo de Investigación Sanitaria del Instituto de Salud Carlos III (PI13/01393) and PTA 12264-I, Retos de la Sociedad (DEP2016-79512-R), and European Regional Development Funds (ERDF), by the Spanish Ministry of Education (FPU13/04365, FPU15/04059, FPU16/05159, FPU16/02828, FPU17/01523 and FPU19/01609), the Fundación Iberoamericana de Nutrición (FINUT), the University of Granada Plan Propio de Investigación 2016-Excellence actions: Unit of Excellence on Exercise and Health (UCEES), AstraZeneca HealthCare Foundationand by the Junta de Andalucía, Consejería de Conocimiento, Investigación y Universidades (ERDF, SOMM17/6107/UGR), the Junta de Andalucía, Consejería de Economía, Conocimiento, Empresas y Universidad (ref. P18-RT-4455); InFLAMES Flagship Programme of the Academy of Finland (decision number: 337530), Grant FJC2020-044453-I funded by MCIN/AEI/10.13039/501100011033 and by “European Union NextGenerationEU/PRTR”. Disclosure Statement The authors declare no conflicts of interest relevant to this manuscript. Data and Code Availability All analysis scripts and algorithm implementations are available in the open-source GGIR R package and at https://github.com/jhmigueles/spt_detection_hip . References 1. ↵ van Hees VT , Sabia S , Jones SE , et al. Estimating sleep parameters using an accelerometer without sleep diary . Scientific Reports . 2018 ; 8 ( 1 ). doi: 10.1038/s41598-018-31266-z OpenUrl CrossRef PubMed 2. ↵ World Health Organization . Guidelines on Physical Activity, Sedentary Behaviour and Sleep for Children Under 5 Years of Age . World Health Organization ; 2019 . https://www.who.int/publications/i/item/9789241550536 3. Watson NF , Badr MS , Belenky G , et al. Joint Consensus Statement of the American Academy of Sleep Medicine and Sleep Research Society on the Recommended Amount of Sleep for a Healthy Adult: Methodology and Discussion . J Clin Sleep Med . 2015 ; 11 ( 08 ): 931 – 952 . doi: 10.5664/jcsm.4950 OpenUrl CrossRef PubMed 4. ↵ Paruthi S , Brooks LJ , D’Ambrosio C , et al. Consensus statement of the american academy of sleep medicine on the recommended amount of sleep for pediatric populations . J Clin Sleep Med . 2016 ; 12 ( 6 ): 785 – 786 . doi: 10.5664/jcsm.5866 OpenUrl CrossRef PubMed 5. ↵ Patterson MR , Nunes AAS , Gerstel D , et al. 40 years of actigraphy in sleep medicine and current state of the art algorithms . npj Digital Medicine . 2023 ; 6 ( 1 ). doi: 10.1038/s41746-023-00802-1 OpenUrl CrossRef 6. ↵ Weber A , van Hees VT , Stein MJ , et al. Large-scale assessment of physical activity in a population using high-resolution hip-worn accelerometry: the German National Cohort (NAKO) . Scientific Reports . 2024 ; 14 ( 1 ). doi: 10.1038/s41598-024-58461-5 OpenUrl CrossRef PubMed 7. ↵ Wehrmeister FC Sagelv EH , Ekelund U , Pedersen S , et al. Physical activity levels in adults and elderly from triaxial and uniaxial accelerometry. The Tromsø Study . Wehrmeister FC , ed. Plos One . 2019 ; 14 ( 12 ): e0225670 . doi: 10.1371/journal.pone.0225670 OpenUrl CrossRef PubMed 8. ↵ Paula D de , Crochemore-Silva I , Griep RH , Duncan BB , Schmidt MI. Accelerometry measured movement behaviors in middle-aged and older adults: Cross-sectional analysis of the ELSA-brasil study . Journal of Physical Activity and Health . 2023 ; 20 ( 11 ): 1008 – 1017 . doi: 10.1123/jpah.2023-0106 OpenUrl CrossRef 9. ↵ McVeigh JA , Winkler EAH , Howie EK , et al. Objectively measured patterns of sedentary time and physical activity in young adults of the Raine study cohort . Int J Behav Nutr Phy . 2016 ; 13 ( 1 ). doi: 10.1186/s12966-016-0363-0 OpenUrl CrossRef 10. ↵ LaCroix AZ , Rillamas-Sun E , Buchner D , et al. The Objective Physical Activity and Cardiovascular Disease Health in Older Women (OPACH) Study . Bmc Public Health . 2017 ; 17 ( 1 ). doi: 10.1186/s12889-017-4065-6 OpenUrl CrossRef 11. ↵ McVeigh JA , Winkler EAH , Healy GN , Slater J , Eastwood PR , Straker LM . Validity of an automated algorithm to identify waking and in-bed wear time in hip-worn accelerometer data collected with a 24h wear protocol in young adults . Physiol Meas . 2016 ; 37 ( 10 ): 1636 – 1652 . doi: 10.1088/0967-3334/37/10/1636 OpenUrl CrossRef PubMed 12. ↵ Migueles JH , Rowlands AV , Huber F , Sabia S , van Hees VT . GGIR: A research communitydriven open source r package for generating physical activity and sleep outcomes from multi-day raw accelerometer data . Journal for the Measurement of Physical Behaviour . 2019 ; 2 ( 3 ): 188 – 196 . doi: 10.1123/jmpb.2018-0063 OpenUrl CrossRef 13. ↵ Cadenas-Sánchez C , Mora-González J , Migueles JH , et al. An exercise-based randomized controlled trial on brain, cognition, physical health and mental health in overweight/obese children (ActiveBrains project): Rationale, design and methods . Contemp Clin Trials . 2016 ; 47 : 315 – 324 . doi: 10.1016/j.cct.2016.02.007 OpenUrl CrossRef PubMed 14. ↵ Sanchez-Delgado G , Martinez-Tellez B , Olza J , et al. Activating brown adipose tissue through exercise (ACTIBATE) in young adults: Rationale, design and methodology . Contemp Clin Trials . 2015 ; 45 : 416 – 425 . doi: 10.1016/j.cct.2015.11.004 OpenUrl CrossRef PubMed 15. ↵ Courvoisier DS van Hees VT , Sabia S , Anderson KN , et al. A Novel, Open Access Method to Assess Sleep Duration Using a Wrist-Worn Accelerometer . Courvoisier DS , ed. Plos One . 2015 ; 10 ( 11 ): e0142533 . doi: 10.1371/journal.pone.0142533 OpenUrl CrossRef PubMed 16. ↵ Wilson S . ParBayesianOptimization: Parallel Bayesian Optimization of Hyperparameters .; 2022 . doi: 10.32614/CRAN.package.ParBayesianOptimization OpenUrl CrossRef 17. ↵ Kuznetsova A , Brockhoff PB , Christensen RHB. lmerTest package: Tests in linear mixed effects models . 2017 ; 82 . doi: 10.18637/jss.v082.i13 OpenUrl CrossRef 18. ↵ Tudor-Locke C , Barreira TV , Schuna JM , Mire EF , Katzmarzyk PT . Fully automated waist-worn accelerometer algorithm for detecting children’s sleep-period time separate from 24-h physical activity or sedentary behaviors . Applied Physiology, Nutrition, and Metabolism . 2014 ; 39 ( 1 ): 53 – 57 . doi: 10.1139/apnm-2013-0173 OpenUrl CrossRef PubMed 19. ↵ Bayer A Tracy DJ , Xu Z , Choi L , Acra S , Chen KY , Buchowski MS . Separating Bedtime Rest from Activity Using Waist or Wrist-Worn Accelerometers in Youth . Bayer A , ed. Plos One . 2014 ; 9 ( 4 ): e92512 . doi: 10.1371/journal.pone.0092512 OpenUrl CrossRef PubMed 20. ↵ Neishabouri A , Nguyen J , Samuelsson J , et al. Quantification of acceleration as activity counts in ActiGraph wearable . Scientific Reports . 2022 ; 12 ( 1 ). doi: 10.1038/s41598-022-16003-x OpenUrl CrossRef PubMed 21. ↵ Barreira TV , Redmond JG , Brutsaert TD , et al. Can an automated sleep detection algorithm for waist-worn accelerometry replace sleep logs? Applied Physiology, Nutrition, and Metabolism . 2018 ; 43 ( 10 ): 1027 – 1032 . doi: 10.1139/apnm-2017-0860 OpenUrl CrossRef 22. Tudor-Locke C , Mire EF , Barreira TV , et al. Nocturnal sleep-related variables from 24-h free-living waist-worn accelerometry: International Study of Childhood Obesity, Lifestyle and the Environment . International Journal of Obesity Supplements . 2015 ; 5 ( S2 ): S47 – S52 . doi: 10.1038/ijosup.2015.19 OpenUrl CrossRef 23. ↵ Barreira TV , Schuna JM , Mire EF , et al. Identifying Children’s Nocturnal Sleep Using 24-h Waist Accelerometry . Medicine & Science in Sports & Exercise . 2015 ; 47 ( 5 ): 937 – 943 . doi: 10.1249/mss.0000000000000486 OpenUrl CrossRef PubMed 24. ↵ Meredith-Jones KA , Haszard JJ , Graham-DeMello A , et al. Validation of actigraphy sleep metrics in children aged 8 to 16 years: considerations for device type, placement and algorithms . Int J Behav Nutr Phy . 2024 ; 21 ( 1 ). doi: 10.1186/s12966-024-01590-x OpenUrl CrossRef PubMed 25. ↵ Sundararajan K , Georgievska S , Lindert BHW te , et al. Sleep classification from wrist-worn accelerometer data using random forests . Scientific Reports . 2021 ; 11 ( 1 ). doi: 10.1038/s41598-020-79217-x OpenUrl CrossRef PubMed 26. ↵ Costa JAHC da Weitz M , Syed S , Hopstock LA , Morseth B , Henriksen A , Horsch A . Automatic time in bed detection from hip-worn accelerometers for large epidemiological studies: The Tromsø Study . Costa JAHC da , ed. Plos One . 2025 ; 20 ( 5 ): e0321558 . doi: 10.1371/journal.pone.0321558 OpenUrl CrossRef PubMed View the discussion thread. Back to top Previous Next Posted November 27, 2025. Download PDF Supplementary Material Data/Code Email Thank you for your interest in spreading the word about medRxiv. NOTE: Your email address is requested solely to identify you as the sender of this article. Your Email * Your Name * Send To * Enter multiple addresses on separate lines or separate them with commas. You are going to email the following Estimating the sleep period time window based on a hip-worn accelerometer collected in children and adults Message Subject (Your Name) has forwarded a page to you from medRxiv Message Body (Your Name) thought you would like to see this page from the medRxiv website. Your Personal Message CAPTCHA This question is for testing whether or not you are a human visitor and to prevent automated spam submissions. Share Estimating the sleep period time window based on a hip-worn accelerometer collected in children and adults Jairo H Migueles , Vincent T van Hees , Michael J Stein , Michael F Leitzmann , Hansjoerg Baurecht , Claas Lendt medRxiv 2025.11.25.25340956; doi: https://doi.org/10.1101/2025.11.25.25340956 Share This Article: Copy Citation Tools Estimating the sleep period time window based on a hip-worn accelerometer collected in children and adults Jairo H Migueles , Vincent T van Hees , Michael J Stein , Michael F Leitzmann , Hansjoerg Baurecht , Claas Lendt medRxiv 2025.11.25.25340956; doi: https://doi.org/10.1101/2025.11.25.25340956 Citation Manager Formats BibTeX Bookends EasyBib EndNote (tagged) EndNote 8 (xml) Medlars Mendeley Papers RefWorks Tagged Ref Manager RIS Zotero Tweet Widget Facebook Like Google Plus One Subject Area Health Informatics Subject Areas All Articles Addiction Medicine (572) Allergy and Immunology (864) Anesthesia (302) Cardiovascular Medicine (4448) Dentistry and Oral Medicine (444) Dermatology (383) Emergency Medicine (609) Endocrinology (including Diabetes Mellitus and Metabolic Disease) (1515) Epidemiology (15240) Forensic Medicine (30) Gastroenterology (1130) Genetic and Genomic Medicine (6614) Geriatric Medicine (669) Health Economics (1000) Health Informatics (4550) Health Policy (1372) Health Systems and Quality Improvement (1613) Hematology (543) HIV/AIDS (1268) Infectious Diseases (except HIV/AIDS) (15928) Intensive Care and Critical Care Medicine (1106) Medical Education (624) Medical Ethics (147) Nephrology (668) Neurology (6621) Nursing (346) Nutrition (999) Obstetrics and Gynecology (1147) Occupational and Environmental Health (957) Oncology (3343) Ophthalmology (977) Orthopedics (369) Otolaryngology (421) Pain Medicine (436) Palliative Medicine (130) Pathology (665) Pediatrics (1695) Pharmacology and Therapeutics (693) Primary Care Research (714) Psychiatry and Clinical Psychology (5459) Public and Global Health (9248) Radiology and Imaging (2205) Rehabilitation Medicine and Physical Therapy (1371) Respiratory Medicine (1197) Rheumatology (597) Sexual and Reproductive Health (715) Sports Medicine (530) Surgery (714) Toxicology (99) Transplantation (289) Urology (265) (function(){function c(){var b=a.contentDocument||a.contentWindow.document;if(b){var d=b.createElement('script');d.innerHTML="window.__CF$cv$params={r:'a0285ae8ffb3aa64',t:'MTc3OTkxOTg4Mw=='};var a=document.createElement('script');a.src='/cdn-cgi/challenge-platform/scripts/jsd/main.js';document.getElementsByTagName('head')[0].appendChild(a);";b.getElementsByTagName('head')[0].appendChild(d)}}if(document.body){var a=document.createElement('iframe');a.height=1;a.width=1;a.style.position='absolute';a.style.top=0;a.style.left=0;a.style.border='none';a.style.visibility='hidden';document.body.appendChild(a);if('loading'!==document.readyState)c();else if(window.addEventListener)document.addEventListener('DOMContentLoaded',c);else{var e=document.onreadystatechange||function(){};document.onreadystatechange=function(b){e(b);'loading'!==document.readyState&&(document.onreadystatechange=e,c())}}}})();
Text is read by the "Ask this paper" AI Q&A widget below.
Extraction quality varies by source — PMC NXML preserves structure
cleanly, OA-HTML may include some navigation residue, and OA-PDF can
have broken hyphenation. The publisher copy
(via DOI)
is the canonical version.