| bouts {accelerometry} | R Documentation | 
Physical Activity Bout Detection
Description
Identify bouts of physical activity based on a vector of accelerometer count values.
Usage
bouts(counts, weartime = NULL, bout_length = 10L, thresh_lower = 0L,
  thresh_upper = 100000L, tol = 0L, tol_lower = 0L, tol_upper = 100000L,
  nci = FALSE, days_distinct = FALSE)
Arguments
| counts | Integer vector with accelerometer count values. | 
| weartime | Integer vector with 1's for wear time minutes and 0's for non-wear time minutes. | 
| bout_length | Integer value specifying minimum length of an activity bout. | 
| thresh_lower | Integer value specifying lower bound for count values to be included for the intensity level. | 
| thresh_upper | Integer value specifying upper bound for count values to be included for the intensity level. | 
| tol | Integer value specifying number of minutes with count values 
outside of [ | 
| tol_lower | Integer value specifying lower cut-off for count values outside of intensity range during an activity bout. | 
| tol_upper | Integer value specifying upper cut-off for count values outside of intensity range during an activity bout. | 
| nci | Logical value for whether to use algorithm from NCI's SAS programs. See Details. | 
| days_distinct | Logical value for whether to treat each day of data as 
distinct, i.e. identify non-wear time and activity bouts for day 1, then day 
2, etc. If  | 
Details
If nci = FALSE, the algorithm uses a moving window to go through 
every possible interval of length bout_length in counts. Any 
interval in which all counts are >= tol_lower and <= 
tol_upper, and no more than tol counts are less than 
thresh_lower or greater than thresh_upper, is classified as an 
activity bout.
If nci = TRUE, activity bouts are classified according to the 
algorithm used in the NCI's SAS programs. Briefly, this algorithm defines an 
activity bout as an interval of length bout_length that starts with a 
count value in [thresh_lower, thresh_upper] and has no more than 
tol counts outside of that range. If these criteria are met, the bout 
continues until there are (tol + 1) consecutive minutes outside of 
[thresh_lower, thresh_upper]. The parameters tol_lower and 
tol_upper are not used.
If the user allows for a tolerance (e.g. tol = 2) and does not use 
the NCI algorithm (i.e. nci = FALSE), specifying a non-zero value for 
tol_lower is highly recommended. Otherwise the algorithm will tend to 
classify minutes immediately before and after an activity bout as being part 
of the bout.
Specifying thresh_lower while using an arbitrarily large value for 
thresh_upper is generally recommended. Specifying both of these 
parameters can be overly restrictive in that the algorithm may miss bouts of 
activity in which counts are consistently high, but not exclusively in one 
intensity range.
Value
Integer vector with 1's for minutes that are part of an activity bout and 0's for minutes that are not.
References
National Cancer Institute. Risk factor monitoring and methods: SAS programs for analyzing NHANES 2003-2004 accelerometer data. Available at: http://riskfactor.cancer.gov/tools/nhanes_pam. Accessed Aug. 19, 2018.
Acknowledgment: This material is based upon work supported by the National Science Foundation Graduate Research Fellowship under Grant No. DGE-0940903.
Examples
# Load accelerometer data for first 5 participants in NHANES 2003-2004
data(unidata)
# Get data from ID number 21005
counts.part1 <- unidata[unidata[, "seqn"] == 21005, "paxinten"]
# Identify periods of valid wear time
wear.part1 <- weartime(counts = counts.part1)
# Identify moderate-to-vigorous activity bouts
mvpa.bouts <- bouts(counts = counts.part1, weartime = wear.part1, 
                    thresh_lower = 2020)