childmindresearch / wristpy

https://childmindresearch.github.io/wristpy/
GNU Lesser General Public License v2.1
3 stars 5 forks source link

Task: Allowing for two types of HDCZA_threshold in the `GGIRSleepDetection._spt_window()` method. #115

Open brutusyhy opened 1 week ago

brutusyhy commented 1 week ago

Description

Currently, GGIRSleepDetection._spt_window() follows the GGIR default behavior of using 0.2 as the threshold value in the Step 6 of the van Hees et al. (2018) algorithm. However, According to the GGIR documentation (https://wadpac.github.io/GGIR/articles/GGIRParameters.html?q=0.2#hdcza_threshold):

Numeric (default = c()) If HASPT.algo is set to “HDCZA” and HDCZA_threshold is NOT NULL, (e.g., HDCZA_threshold = 0.2), then that value will be used as threshold in the 6th step in the diagram of Figure 1 in van Hees et al. 2018 Scientific Report (doi: 10.1038/s41598-018-31266-z). However, doing so has not been supported by research yet and is only intended to facilitate methodological research, so we advise sticking with the default in line with the publication. Further, if HDCZA_threshold is set to a numeric vector of length 2, e.g. c(10, 15), that will be used as percentile and multiplier for the above mentioned 6th step.

The original van Hees et al. paper also provided a convincing argument for a dynamic threshold:

This is used as a critical individual night derived threshold to distinguish periods of time involving many and few posture changes.

Since the patterns of posture change for different individuals and individuals at different nights could be highly varied, using a dynamic method might be better than a fixed threshold. Furthermore, it would also make the function line up with the GGIR, which also provides the option for dynamic thresholding.

Tasks

Freeform Notes

No response

Asanto32 commented 1 week ago

Hi, Thanks for making this issue, we hadn't considered it just yet. At the moment we are working on incorporating our own sleep prediction models and that will take priority. We have not seen much use of modifying this parameter in practice, however if it becomes something that is requested we will consider implementing it. Thanks for pointing it out!