process_flags: Process wear/non-wear flags for NHANES 2003-2004 and...

Description Usage Arguments Details Value References Examples

View source: R/process_accel.R

Description

This function creates wear/non-wear flag matrices for processed NHANES 2003-2004 and 2005-2006 accelerometry data. The underlying algorithm for estimating wear/non-wear flags is implemented in the weartime function from the accelerometry package.

Usage

1
2
3
4
5
6
7
8
process_flags(
  x,
  days_distinct = FALSE,
  window = 90L,
  tol = 2L,
  tol_upper = 99L,
  ...
)

Arguments

x

A list with each element corresponding to a data matrix of activity counts in the 1440+ format with 7 rows per individual. Each element of x should be named, and each name should correspond to the naming convention used by the output of process_accel. For example, the processed accelerometry data corresponding to the 2003-2004 wave should be named "PAXINTEN_C". The data should be sorted by participant (SEQN) and then in descending order chronologically. If days are not ordered chronologically and distinct_days=FALSE, then the resulting wear/non-wear flag output may not be accurate. The output of process_accel can be fed directly to this argument. See examples.

days_distinct

Logical value indicating whether days should be treated as distinct time series within participants. If TRUE, then subjects' wear status at 11:59PM does not affect their wear status at 00:01AM the next morning. Defaults to FALSE, this is generally recommended.

window

Numeric value indicated the size of the moving window used to assess non-wear in minutes. Defaults to 90 minutes. See weartime for more details.

tol

maximum number of minutes with counts greater than 0 within the a non-wear interval. See weartime for more details.

tol_upper

maximium activity count for any minute within the window Defaults to 99. That is, for a given minute, if the window contains any minutes with activity counts greater than tol.upper, this minute is considered "wear". See weartime for more details.

...

aditional arguments to be passed to weartime.

Details

There are many way to estimate non-wear periods in accelerometry data. Fundamentally, they all involve finding extended periods of implausibly low activity. However, there is no one perfect algorithm, and what qualifies as "implausible" is device-, placement-, and population-dependent. Here, we use the algorithm implemented by default in the accelerometry package via the weartime function. This algorithm is similar to the algorithm used in Troiano et. al (2008).

There are a number of parameters the algirothm implemented in weartime uses to control how aggressive non-wear time identification is. By making the algorithm more agressive (decreasing window size, increasing tolerance for non-zero activity counts), one increases the likelihood of false positives. Conversely, making the algorithm less agressive increases the likelihood of false negatives. By default we use a fairly conservative window size of 90 minutes.

Value

The function process_flags returns a list with number of elemnts equal to the number of elements in the object supplied to the "x" argument. Each element of the list returned is a dataframe that mirrors the format of dataframes returned from the process_accel function, but instead with the columns conveying activity count data replaced with 0/1 indicators for estimated periods of non-wear. More specifically, each element is a data frame with the following columns

References

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
library("rnhanesdata")
## In the interest of reducing computation time for this example,
## we use the already processed accelerometry data
accel_ls <- list("PAXINTEN_C" = PAXINTEN_C, "PAXINTEN_D" = PAXINTEN_D)
flags_ls <- process_flags(x=accel_ls)

## Check to see that these processed flags are identical to
## those provided in the package
identical(flags_ls$Flags_C, Flags_C)
identical(flags_ls$Flags_D, Flags_D)

## End(Not run)

andrew-leroux/rnhanesdata documentation built on March 6, 2020, 11:35 p.m.