Question/Warning on new default non-wear detection and its implication on SPT detection

289 views
Skip to first unread message

Pieter-Jan Marent

unread,
Nov 29, 2023, 10:59:25 AM11/29/23
to R package GGIR
Dear all

After rerunning my dataset with the latest GGIR version (3.0-1), some default settings have been changed. Non-wear detection is now version 2023 which can have some important implications on sleep period detection. The default version of the non-wear window (argument windowsizes) is 1h (3600 seconds) and this long window is now flagged entirely as non-wear (in stead of the 15 min in 2013 version), see vignette or https://www.accelting.com/updates/ggir-release-3-0-0/. It seems like this can lead to potential errors in sleep period time detection. This is a warning/question to further investigate.

To illustrate my concern with a real example of my dataset (wrist-worn actigraph):

One of my participants indicated in their diary that they went to bed at 00.35 (time in bed) and fell asleep at 00.45 (sleep time). Time in bed was used in a sleep log to aid sleep period time detection.

When using the 2013 version of non-wear detection (previously default), sleep onset was found to be at 0:42:00. Which is in line with the visual inspection of the raw data and the diary.

When using the 2023 version of non-wear detection (default in version 3.0-1), sleep onset was found to be at  2:15:00. The reason for this 1,5h difference is that the 2023 version flagged the whole first hour of sleep as non-wear, where the 2013 only found a small portion to be non-wear. Since the argument "ignorenonwear" is set to TRUE (default), SPT detection only started after this non-wear hour. Resulting in this important misclassification. 

I have added screenshots from the visual report, but of course checked these findings in the csv files. 

And this is not the only case, I have another night where sleep efficiency scores dropped from 96% to 79% because of this change in non-wear classification.

Could someone confirm this? How is it possible that during sleep, non-wear detection is triggered? 

Always happy to share my script and the files if needed, but this was more a general warning/question. 

Warm regards,
Pieter-Jan

PS/ on a higher level: any non-wear in this night seems to be a mistake as the participant did not indicate taking it off the device + even if they removed it after falling asleep, you would suspect a clear "wake during the night" when they put the device back on which is not shown in the data... 

GGIR_2013_2023.png


Jairo Hidalgo Migueles

unread,
Dec 1, 2023, 9:08:55 AM12/1/23
to R package GGIR
Hi Pieter,

Thank you for reporting this. May I ask if the actigraph device was initialized with the idle sleep mode turned on? That low variability in the acceleration for such a long time is very unlikely if the devices was being worn. You may also consider increasing the time for the longest windowsize, default is 1 hour (3600 seconds). It seems like some people may deep sleep until ~75 minutes, it is not frequent but still possible. Either way, I think this is quite a specific case which does now allow for evaluation of the nonwear algorithm.

Best,
Jairo

Ari Shechter

unread,
Feb 16, 2024, 10:51:07 AMFeb 16
to R package GGIR

hi all, I came across this message to the forum about GGIR mis-classifying large segments of what is most likely sleeping time as non-wear time, and skewing sleep outputs.

We saw very similar findings when we ran GGIR with the latest version, and saw that sleep periods were truncated and estimates of sleep time to be reduced.

We tried re-running the data again with the parameter “ignorenonwear = false” in Part 3, and the data look much better.

We will also try running it to keep using the older approach by setting the  argument nonwear_approach to “2013” but haven’t done this yet. 

We are also looking into altering the window size parameter of defining nonwear.

It seemed that Jairo in reply to earlier post suggested using a 75 minute as opposed to 60 min window. We will try this as well but I am not sure that will be a good solution, since we saw occurrences when very long periods (> 75 min), large portions of the sleep period,  were flagged as non-wear. 

Have others run into this and if so, does anyone have any other suggestions or recommendations on how to address this?

We are also interested in measures of waking physical activity, sedentary behavior, and also the non-parametric daily activity (for example, L5, M10, intradaily variability, interdaily stability) so not sure we want to completely disregard what is considered non-wear outside of the sleep period.

thanks all!

Vincent van Hees

unread,
Feb 28, 2024, 5:05:07 AMFeb 28
to Ari Shechter, Jairo Hidalgo Migueles, R package GGIR
Question to Jairo: do the updates in https://github.com/wadpac/GGIR/pull/1067 that I just merged in the new 3.0-7 release offer a better solution or guidance in relation to this?
I suspect those updates which entail the option to set HASPT.ignore.invalid = NA, is mainly relevant to studies who know that the accelerometer is not worn during the night, while here the issue is that the accelerometer is expected to be throughout the night. Nonetheless, maybe it does help...

Note: 3.0-7 is only available on GitHub, install with remotes::install_github("wadpac/GGIR", ref = "3.0-7").

Question to Ari and Pieter-Jan: Which accelerometer brand are you using? I am wondering whether this is issue could be specific to certain accelerometer brand(s). For example, I imagine that ActiGraph with idle sleep mode turned on might become idle when a person somehow does not move for more than an hour.

Kind regards,
Vincent
--
You received this message because you are subscribed to the Google Groups "R package GGIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to RpackageGGIR...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/RpackageGGIR/e2d000f7-f35e-40dc-83c5-0b570c93d1fan%40googlegroups.com.

Ari Shechter

unread,
Feb 28, 2024, 11:01:25 AMFeb 28
to R package GGIR
thank you, we are using the GENEActiv

Jairo Hidalgo Migueles

unread,
Mar 12, 2024, 4:48:54 AMMar 12
to R package GGIR
Hi all,

I have recently tested the changes in https://github.com/wadpac/GGIR/pull/1067 in a dataset in which participants often removed accelerometer during nights (eventhough they were expected to wear them). Results were promising that that dataset, providing a more "coherent" separation of nighttime and daytime using the nonwear time as indicator of no movement. To use this approach, you need to use GGIT version 3.0-7 or newer and define  HASPT.ignore.invalid = NA. For example:

remotes::install_github("wadpac/GGIR") # this install current version of GGIR in the master branch, as for today version 3.0-8
GGIR([your_GGIR_input_parameters]
           HASPT.ignore.invalid = NA)

Note this is not the default value for  HASPT.ignore.invalid and you need to specify that.

Best,
Jairo
 

El miércoles, 28 de febrero de 2024 a las 17:01:25 UTC+1, Ari Shechter escribió:
thank you, we are using the GENEActiv

On Wednesday, February 28, 2024 at 5:05:07 AM UTC-5 Vincent van Hees wrote:
Question to Jairo: do the updates in https://github.com/wadpac/GGIR/pull/1067 that I just merged in the new 3.0-7 release offer a better solution or guidance in relation to this?
I suspect those updates which entail the option to set HASPT.ignore.invalid = NA, is mainly relevant to studies who know that the accelerometer is not worn during the night, while here the issue is that the accelerometer is expected to be throughout the night. Nonetheless, maybe it does help...

Note: 3.0-7 is only available on GitHub, install with remotes::install_github("wadpac/GGIR", ref = "3.0-7").

Question to Ari and Pieter-Jan: Which accelerometer brand are you using? I am wondering whether this is issue could be specific to certain accelerometer brand(s). For example, I imagine that ActiGraph with idle sleep mode turned on might become idle when a person somehow does not move for more than an hour.

Kind regards,
Vincent

Ari Shechter

unread,
May 22, 2024, 1:18:52 PMMay 22
to R package GGIR
thanks again very much Jairo and Vincent, this is a helpful discussion. 

Because we think the new 2023 non-wear detection is incorrectly labelling sleeping time as "non-wear," we re-ran the program with “ignorenonwear = false” in Part 3. This seems to have helped with giving a more realistic sleep period duration (SptDuration). However, it still gives an incorrect estimation of SleepDurationInSpt (too low) and WASO (too high) because rather than deeming the "non-wear" period (green in figure below) as sleep, it just disregards that period of time altogether.   

This is an issue because the algorithm appears to calculate WASO as SPTDuration - SleepDurationInSPT, which is a problem if those non-wear periods during the night aren't labeled as sleep because it underestimates of total sleep time and inflates WASO estimates. 

Our question is: Is a setting that we could change that would tell GGIR to label those green non-wear periods during the SPT as sleep?

Screenshot 2024-05-22 131710.png

Vincent van Hees

unread,
May 31, 2024, 11:28:07 AMMay 31
to Ari Shechter, R package GGIR
Hi Ari,

Did you try what Jairo suggested? If yes, please report back on how that went. 

Thanks,
Vincent

Chong Kar Hau

unread,
Jun 25, 2024, 8:38:35 PM (4 days ago) Jun 25
to Jairo Hidalgo Migueles, R package GGIR
Hi Jairo and Vincent

I have a question about the difference between HASPT.ignore.invalid = NA vs. HASPT.ignore.invalid = TRUE. Based on the vignette, the NA option is recommended when the accelerometer is often not worn during the night; while the TRUE option is recommended when the accelerometer is often not worn during the waking hours of the day. Which of these works better, in your opinion, for distinguishing between daytime and nighttime in data collected using a 24-hour protocol? This protocol often includes both scenarios where the accelerometer was removed during the day for certain activities and was not worn during sleep.


Thank you.

Best regards,
John.



Jairo Hidalgo Migueles

unread,
Jun 26, 2024, 1:54:59 AM (4 days ago) Jun 26
to R package GGIR
Hi John,

This would mainly affect nonwear closeby the sleep period time (SPT) window. If HASPT.ignore.invalid = TRUE, then nonwear closeby SPT would be ignored, i.e., would be left out of the SPT and considered to be awake time. If HASPT.ignore.invalid = NA, nonwear closeby SPT is considered to represent no movement and most likely will be part of the SPT window.

So, I guess it depends on your research focus. If you are mainly interested in sleep, I would not want the nonwear to be part of the SPT, but you are mainly in awake behaviors, maybe classifying those nonwear segments within the SPT window would be more appropriate. 

Just to be clear, this only affects the cases in which nonwear is very close to the SPT window, and not all the nonwear periods.

Best,
Jairo

Chong Kar Hau

unread,
Jun 26, 2024, 2:33:17 AM (4 days ago) Jun 26
to Jairo Hidalgo Migueles, R package GGIR
Hi Jairo

Thanks for the prompt response and the clarification. If I understand correctly, it is probably better for me to set  HASPT.ignore.invalid = TRUE for a more accurate classification of SPT window? 

Thank you.

Best regards,
John.


Jairo Hidalgo Migueles

unread,
Jun 26, 2024, 2:42:31 AM (4 days ago) Jun 26
to R package GGIR
Not sure if more accurate. You would assume that a person does not remove the device right before starting the SPT and then wears it again in the middle of the night. If this occurs, this specific nonwear chunk would be considered to be awake time if "HASPT.ignore.invalid = TRUE".

Best,
Jairo

Chong Kar Hau

unread,
Jun 26, 2024, 2:54:16 AM (4 days ago) Jun 26
to Jairo Hidalgo Migueles, R package GGIR
Thanks Jairo! 

Thank you.

Best regards,
John.


Reply all
Reply to author
Forward
0 new messages