Detection of Sleep Period Time

63 views
Skip to first unread message

Xinting Yu

unread,
Dec 13, 2021, 4:25:18 PM12/13/21
to R package GGIR
Hi All,
We are going to use GGIR for our cohort study. We collect sleep diary but we are very interested in using the GGIR functions to detect the SPT automatically. I run GGIR with or without the sleep log guidance and found the outputs very close in the participants with relatively healthy sleep, i.e. without too many night awakenings. But we had some challenge when running GGIR in subjects with frequent night awakenings. Please see an example (night 6) I attached. GGIR detected the wakeup time at midnight around 2 am which might be before the first night awakening but not the final one at around 7-8am which could be more reasonable. Could you please give me some suggestion how I can fix this? Can I use spt_max_gap or/and sptblocksize ?
Thank you so much!!

Sincerely,
Xinting
GGIR SPT detection question.png

Vincent van Hees

unread,
Dec 17, 2021, 9:52:48 AM12/17/21
to Xinting Yu, R package GGIR
Hi Xinting,

The HDCZA algorithm aims to detect the main sleep period per 24 hours. If there are two main sleep periods it picks the longest. I suppose we can tweak the parameters to make it ignore larger time gaps between sleep periods, but at the moment I have not facilitated this as I am concerned that it will lead to methodological inconsistencies in research without clear literature guidance on which configuration should be used.

The approach I would prefer is to first establish a definition of multiple sleep periods per day, this should be let by experienced sleep researchers as it is a construct definition challenge and not a data science challenges. Next, we can enhance GGIR to quantify and characterise those multiple sleep periods. This would be a significant amount of work. One solution is that you or someone else hires me to work on this as a paid consultancy. Another solution is that someone else does all the work as a code contribution to GGIR with me in smaller, but still paid, advising role.

If you are interested then let me know via direct message.

Kind regards,
Vincent

Dr. Vincent van Hees | Independent consultant | https://accelting.com/
image


‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
--
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/8a828bf6-8b65-40af-8d90-bf81df30ec48n%40googlegroups.com.

Xinting Yu

unread,
Dec 17, 2021, 3:41:00 PM12/17/21
to R package GGIR

I successfully loaded the advanced sleep diary. Thank you so much, Vincent!!

In our study, we had scenarios that some subjects started wearing the watch several days after the watch  initiation. I was wondering if GGIR could detect the calendar date and automatically match the N th day from bin or milestone data so that the colleagues who entered the log data didn’t need to worry about which day the log data should be located but just started to enter the data continuously from the second column. I tried but it seemed I had to know which day the subject started to wear from the watch initiation date. 

Warm regards,
Xinting

Vincent van Hees

unread,
Feb 20, 2022, 10:56:42 AMFeb 20
to Xinting Yu, R package GGIR
Hi Xinting,

I just noticed that I did not reply to your message from December.

I see what you want. The risk with such an automated matching of sleeplog that do not have a calendar date and accelerometer data is that the matching fails. For example,  if a person starts wearing the accelerometer but takes it off the second day and then wears it again the following day. I am concerned that an automated algorithm will have difficulty making the judgment when the wear period truly started.

Regards,
Vincent

------- Original Message -------
Message has been deleted

Xinting Yu

unread,
Mar 2, 2022, 1:16:52 PMMar 2
to R package GGIR
Thanks so much for your reply, Vincent!
I totally agree with you it is reasonable not to match consecutively from the first available date/time in the sleep log. I was wondering it would be great if GGIR could handle the calendar dates and we didn't need to take care of how many days between the watch initiation and the first wearing date as in real studies subjects usually got themselves ready and started wearing several days after the watch initiation. Now I think we need to count it and start to fill (or leave it blank) the sleep patterns from the initiation date as day 1 for the sleep log.

Best,
Xinting

Vincent van Hees

unread,
Mar 7, 2022, 11:38:54 AMMar 7
to Xinting Yu, R package GGIR
The advanced sleep log format is designed to facilitate that:

Vincent


Dr. Vincent van Hees | Independent consultant | https://accelting.com/
image

------- Original Message -------

On Wednesday, March 2nd, 2022 at 19:15, Xinting Yu <yuxi...@gmail.com> wrote:

Thanks so much for your reply, Vincent!
I totally agree with you it is reasonable not to match consecutively from the first available date/time in the sleep log. I was wondering it would be great if GGIR could handle the calendar dates and we don't need to take care of how many days between the watch initiation and the first wearing date as in real studies subjects usually got themselves ready and started wearing several days after the watch initiation. Now I think we need to count it and start to fill (or leave it blank) the sleep patterns from the initiation date as day 1 for the sleep log.

Best,
Xinting
Reply all
Reply to author
Forward
0 new messages