Score actigraphy epochs as wake or sleep using the Cole-Kripke algorithm
Source:R/cole_kripke.R
score_epochs_cole_kripke.RdApplies the Cole-Kripke algorithm to a vector of zero-crossing mode (ZCM)
activity counts, scoring each epoch as wake (1) or sleep (0) using a
weighted sum of activity in a surrounding window.
Arguments
- zcm
numericvector of ZCM activity counts, one value per epoch.- P
numeric(1). Scaling factor. Default is0.000464(Cole et al., 1992).- weights_before
numeric(9). Weights applied to the 9 epochs before the current epoch. Defaults to the values from Cole et al. (1992), Table 2.- weights_after
numeric(8). Weights applied to the 8 epochs after the current epoch. Defaults to the values from Cole et al. (1992), Table 2.
Details
Each epoch's score is computed as:
$$D_i = P \sum_{j=1}^{9} W_j^{-} \cdot A_{i-j} + P \sum_{j=1}^{8} W_j^{+} \cdot A_{i+j}$$
where \(A_i\) is the ZCM count at epoch \(i\), \(W^{-}\) and \(W^{+}\) are the before and after weight vectors from Cole et al. (1992), and \(P = 0.000464\). Epochs with \(D_i \ge 1\) are scored as wake.
References
Cole, R. J., Kripke, D. F., Gruen, W., Mullaney, D. J., & Gillin, J. C. (1992). Automatic sleep/wake identification from wrist activity. Sleep, 15(5), 461–469. doi:10.1093/sleep/15.5.461
Examples
if (FALSE) { # \dontrun{
rec <- read_acttrust("recordings/P001.txt")
scores <- score_epochs_cole_kripke(rec$ZCMn)
table(scores) # 0 = sleep, 1 = wake
} # }