HomeGGIR release 2.5-0

GGIR release 2.5-0

Wednesday,  November 3, 2021

In this blog post I will talk you through the main updates to the new GGIR 2.5-0 release. For a full list of updates since the previous CRAN release (version 2.4-0), see the GGIR changelog.

(NEW) Tutorial on segmented day analysis

Day segment specific analysis are valuable when studying context specific physical activity. A new tutorial vignette has been added on how to perform an analysis per segment of the day. The tutorial discusses how to segment the day based on clock hours of the day, but also how to use an activity log to tailor the segmentation per participant.

The creation of this tutorial has been sponsored by Dr. Beets and the Arnold Childhood Obesity Initiative Research Group at the University of South Carolina.

(NEW) Sleep Regularity Index

Another addition in GGIR 2.5-0 is the Sleep Regularity Index (SRI). This is a measure of sleep regularity between successive days, as first described by Phillips and colleagues. The SRI can have a value between -100 and 100, where 100 reflects perfect regularity (identical days), 0 reflects random pattern, and -100 reflects perfect reversed regularity. The SRI is proposed to only be calculated based on seven, or a multitude of seven, consecutive days of data without missing values. This to avoid a possible role of imbalanced data to the final estimate. However, this renders many datasets unsuitable for analysis and leads to a painful loss in sample size and statistical power.

Sleep Regularity Index – Dealing with unbalanced data

To address this, I implemented the SRI in GGIR per day-pair. Per day-pair GGIR now stores the SRI value and the fraction of the 30 second epoch-pairs between both days that are valid. This fraction can be found in the output under the variable name SriFractionValid. By default, day-pairs are excluded if this fraction is below 0.66. For those familiar with GGIR this threshold is coupled with the 16-hour default value for argument “includenightcrit”. For example, if you set argument “includenightcrit = 12”, the fraction threshold will be: 12 / 24 = 0.5. Note that I have implemented the SRI calculation such that it accounts for the missing values in the denominator. As a result, the SRI value interpretation remains unchanged.

The 30 second epoch setting is automatically applied, even if the rest of the GGIR process works with a different epoch duration.

The day-pair level estimates are stored as variable SleepRegularityIndex in the .csv-report on sleep (GGIR part4 for those familiar with GGIR). Further, GGIR also stores the person-level aggregates such as: the plain average over all valid days, the average of all valid weekend days, and the average of all valid week days. No GGIR input arguments are needed to invoke the SRI calculation. The calculation is automatically performed after updating GGIR and processing your data.

Sleep Regularity Index – Benefits of the revised approach
  • It enables the user to study the day-pair to day-pair variation in SRI, and the role of day-pair inclusion criteria.
  • The access to SRI at day-pair level makes it possible to account for an imbalanced datasets via multi-level regression analysis applied to the output of GGIR, with day-pair as one of the model levels.

The implementation of the Sleep Regularity Index has been sponsored by Dr. Beets and the Arnold Childhood Obesity Initiative Research Group at the University of South Carolina.

(REMOVED) Sensor fusion functionality

In GGIR version 2.2-2 (early 2021), a new functionality was added to facilitate the fusion of accelerometer and gyroscope signals at raw data level. This work was done as an expertise development project, but it has become clear that there is no major added value of this functionality for GGIR. Please note that the code is still in the GitHub and CRAN history, such that it can be revived if ever needed.

(NEW) Advanced sleeplog format now facilitated

For a long time, GGIR only facilitated one specific type of sleeplog format. The format assumed that the first night in the accelerometer recording corresponds with the first night in the sleeplog. As you can imagine, this complicates the analyses of accelerometer recordings that are not aligned with sleeplog entries.

In the newly added advanced sleep log format, recording dates are stored per night and used by GGIR to ensure correct alignment of each single night in the sleeplog with corresponding night in the accelerometer data. Additionally, the advanced sleeplog format allows for optional storing of information such as non-wear and napping behaviour. At the moment, GGIR extracts and stores these additional types of information in the GGIR milestone data. Integration in the GGIR reports is work in progress. See GGIR vignette paragraph on sleep analysis for further details.

The addition of the advanced sleeplog format has been sponsored by Dr. Plancoulaine and Dr. Bernard from the Research Team on Early life origins of health (EAROH) at the Centre for Research in Epidemiology and Statistics, Université de Paris, Inserm in Paris.

(NEW) Sadeh and Galland sleep classification

An attempt has been made to implement the sleep classification algorithms proposed by Sadeh et al. 1994 and Galland et al. 2012. I am calling it an attempt, because both algorithms rely on summary measures of the data produced by proprietary wearable sensor technology, referred to as ‘counts’.

In short, Sadeh and colleagues detailed that their counts were generated by the Motionlogger actigraph by Ambulatory Monitoring Inc, and explained that the ‘counts’ represented a zero-crossing count of the acceleration signal. However, critical parts of the calculation to support scientific reproducibility were not published. The lack of transparency has been typical for many wearable sensor manufacturers from the late 20th century. Consequently, it has complicated comparisons of research findings in both the sleep and physical activity research communities.

Sadeh and Galland sleep classification – Brønd(eel)Counts to the rescue?

To facilitate backward comparability of modern accelerometer data with count-technology, Jan Brønd et al. proposed an algorithm to estimate the count values produced by one of the other manufacturers, and Ruben Brondeel released the algorithm as open source R package. Their counts, let’s call them the Brønd(eel)Counts, do not count zero-crossings but calculate the area under the filtered acceleration signal. Despite this fundamental difference in calculation, there are preliminary hints now that the Brønd(eel)Counts are possibly more suitable for use with the Sadeh algrotihm then the zero-crossing counts. If this would be true than that would indicate that the description given by Sadeh in 1994 did not reflect the actual proprietary calculation done by the Motionlogger actigraph at the time.

My plan is to embed the combination of Brønd(eel)Counts and Sadeh and Galland algorithm in the next GGIR release to facilitate a direct comparison. For details on how to use the current approach see vignette paragraph on sleep analysis arguments.

The implementation of the Sadeh and Galland algorithms has been sponsored by Dr. Plancoulaine and Dr. Bernard from the Research Team on Early life origins of health (EAROH) at the Centre for Research in Epidemiology and Statistics, Université de Paris, Inserm in Paris.

(NEW) sleepwindowType

Until now the GGIR-based sleep analysis came with the assumption that the either of the following conditions is true:

  • The user has not collected sleeplog data to guide the accelerometer-based sleep analysis.
  • The user collected sleeplog data, which asked for sleep onset and waking-up time (Sleep Period Time window).

The disadvantage of both scenarios is that sleep latency and sleep efficiency cannot be estimated. GGIR version 2.5-0 addresses this for the two scenarios described below. In both scenario 1 and 2, sleep latency and sleep efficiency will be estimated and included in the .csv-report on sleep (GGIR part 4).

Scenario 1: The sleeplog records time in bed

To inform GGIR about this scenario specify input argument: sleepwindowType = “TimeInBed”. Note that the default value is “SPT” (Sleep Period Time window).

Scenario 2: Accelerometer worn on the hip

In this scenario we can attempt to detect lying down based on estimating the accelerometer orientation. To use this functionality specify argument: sensor.location=”hip”.  For a more elaborate description see vignette paragraph on guiders.

Note: The sleepwindowType feature was accidentally disabled in the 2.5-0 release on CRAN. This has now been corrected in the development version of GGIR on GitHub. To install the updated development version use the following commands in the R(Studio) console:

remotes::install_github("wadpac/GGIR", ref = "2.5-1")

The addition of the sleepwindowType option has been sponsored by Dr. Plancoulaine and Dr. Bernard from the Research Team on Early life origins of health (EAROH) at the Centre for Research in Epidemiology and Statistics, Université de Paris, Inserm in Paris.

GGIR release 2.5-0