It first uses a 24 h cosinor fit (via sleep_cos()) and a chosen thresholding rule to
label each minute as sleep (label.sw = 1) or wake (label.sw = 0).
Reference: Shanshan Chen, and Xinxin Sun.Validating CircaCP:
a generic sleep–wake cycle detection algorithm for unlabelled actigraphy data.
Royal Society Open Science 11, no. 5 (2024): 231468.
sleep_detection(clean_df, thr = 0.2, dist = "ZAG")a data.frame augmenting the input df including the following additional variables:
fitted cosine curve
circadian cycle estimated by dichotimized cosine curve
sleep-wake cycle estimated by CircaCP
range-normalized activity levels
Minute-level data.frame with at least Activity. Additional
columns are preserved.
Numeric threshold in [0, 1] applied to a rescaled cosinor fit.
Character method key (e.g., "ZAG"); interpreted by your rule set.
screen_wear(), sleep_cos(),cp_detect(), extract_sleep_metrics()