Flags non-wear time from raw acceleration by the van Hees et al. (2013) / GGIR
standard-deviation-and-range rule: a block is non-wear when, over a window
centred on it (default 60 minutes), at least two of the three axes have both a
standard deviation below sd_crit and a value range below
range_crit. A stationary, taken-off device reads as non-wear. This lets
the z-angle sleep detector tell device-off periods from real sleep (a still arm
that keeps micro-movement). Pass the result as the
wear argument of rest.spt.
Usage
detect.nonwear.raw(
x,
device = "auto",
epoch = 5,
block = 300,
window = 3600,
sd_crit = 0.013,
range_crit = 0.05,
tz = "UTC"
)Arguments
- x
A path to a raw file or a raw data frame (see
raw.metrics).- device
Device brand or
"auto"(file input only).- epoch
Output epoch length in seconds for the returned mask (default 5, matching
rest.spt).- block
Internal classification block length in seconds (default 300; GGIR steps the 60-minute window in 15-minute blocks, so boundaries can differ by a few minutes from GGIR's grid).
- window
Window in seconds over which the SD and range are taken (default 3600).
- sd_crit
Per-axis SD threshold in g (default 0.013).
- range_crit
Per-axis range threshold in g (default 0.050).
- tz
Time zone (default
"UTC").
References
van Hees VT, Gorzelniak L, Dean Leon EC, Eder M, Pias M, Taherian S, Ekelund U, Renstrom F, Franks PW, Horsch A, Brage S (2013). “Separating movement and gravity components in an acceleration signal and implications for the assessment of human daily physical activity.” PLoS ONE, 8(4), e61691. doi:10.1371/journal.pone.0061691 .
Examples
# \donttest{
raw <- example_raw(days = 2, device_off = 1) # two worn days + one device-off day
mean(detect.nonwear.raw(raw, epoch = 60)) # fraction of epochs worn
#> [1] 0.6736111
# }
