process_uni {accelerometry}R Documentation

Process Uniaxial Minute-to-Minute Accelerometer Data

Description

Calculates a variety of physical activity variables based on uniaxial minute-to-minute accelerometer count values for individual participants. Assumes first 1440 minutes are day 1, next 1440 are day 2, and so on. If final day has less than 1440 minutes, it is excluded. A data dictionary for the variables created is available here: https://github.com/vandomed/accelerometry/blob/master/process_uni_dictionary.csv.

Usage

process_uni(counts, steps = NULL, nci_methods = FALSE, start_day = 1,
  start_date = NULL, id = NULL, brevity = 1, hourly_var = "cpm",
  hourly_wearmin = 0, hourly_normalize = FALSE, valid_days = 1,
  valid_wk_days = 0, valid_we_days = 0, int_cuts = c(100, 760, 2020,
  5999), cpm_nci = FALSE, days_distinct = FALSE, nonwear_window = 60,
  nonwear_tol = 0, nonwear_tol_upper = 99, nonwear_nci = FALSE,
  weartime_minimum = 600, weartime_maximum = 1440,
  active_bout_length = 10, active_bout_tol = 0, mvpa_bout_tol_lower = 0,
  vig_bout_tol_lower = 0, active_bout_nci = FALSE, sed_bout_tol = 0,
  sed_bout_tol_maximum = int_cuts[2] - 1, artifact_thresh = 25000,
  artifact_action = 1, weekday_weekend = FALSE, return_form = "averages")

Arguments

counts

Integer vector with accelerometer count values.

steps

Integer vector with steps.

nci_methods

Logical value for whether to set all arguments so as to replicate the data processing methods used in the NCI's SAS programs. More specifically:

valid_days = 4

valid_wk_days = 0

valid_we_days = 0

int_cuts = c(100, 760, 2020, 5999)

cpm_nci = TRUE

days_distinct = TRUE

nonwear_window = 60

nonwear_tol = 2

nonwear_tolupper = 100

nonwear_nci = TRUE

weartime_minimum = 600

weartime_maximum = 1440

active_bout_length = 10

active_bout_tol = 2

mvpa_bout_tol_lower = 0

vig_bout_tol_lower = 0

active_bout_nci = TRUE

sed_bout_tol = 0

sed_bout_tol_maximum = 759

artifact_thresh = 32767

artifact_action = 3

If TRUE, you can still specify non-default values for brevity and weekday_weekend.

start_day

Integer value specifying day of week for first day of monitoring, with 1 = Sunday, ..., 7 = Satuday.

start_date

Date for first day of monitoring, which function can use to figure out start_day.

id

Numeric value specifying ID number of participant.

brevity

Integer value controlling the number of physical activity variables generated. Choices are 1 for basic indicators of physical activity volume, 2 for addditional indicators of activity intensities, activity bouts, sedentary behavior, and peak activity, and 3 for additional hourly count averages.

hourly_var

Character string specifying what hourly activity variable to record, if brevity = 3. Choices are "counts", "cpm", "sed_min", "sed_bouted_10min", and "sed_breaks".

hourly_wearmin

Integer value specifying minimum number of wear time minutes needed during a given hour to record a value for the hourly activity variable.

hourly_normalize

Logical value for whether to normalize hourly activity by number of wear time minutes.

valid_days

Integer value specifying minimum number of valid days to be considered valid for analysis.

valid_wk_days

Integer value specifying minimum number of valid weekdays to be considered valid for analysis.

valid_we_days

Integer value specifying minimum number of valid weekend days to be considered valid for analysis.

int_cuts

Numeric vector with four cutpoints from which five intensity ranges are derived. For example, int_cuts = c(100, 760, 2020, 5999) creates: 0-99 = intensity 1; 100-759 = intensity level 2; 760-2019 = intensity 3; 2020-5998 = intensity 4; >= 5999 = intensity 5. Intensities 1-5 are typically viewed as sedentary, light, lifestyle, moderate, and vigorous.

cpm_nci

Logical value for whether to calculate average counts per minute by dividing average daily counts by average daily wear time, as opposed to taking the average of each day's counts per minute value. Strongly recommend leave as FALSE unless you wish to replicate the NCI's SAS programs.

days_distinct

Logical value for whether to treat each day of data as distinct, as opposed to analyzing the entire monitoring period as one continuous segment.

nonwear_window

Integer value specifying minimum length of a non-wear period.

nonwear_tol

Integer value specifying tolerance for non-wear algorithm, i.e. number of minutes with non-zero counts allowed during a non-wear interval.

nonwear_tol_upper

Integer value specifying maximum count value for a minute with non-zero counts during a non-wear interval.

nonwear_nci

Logical value for whether to use non-wear algorithm from NCI's SAS programs.

weartime_minimum

Integer value specifying minimum number of wear time minutes for a day to be considered valid.

weartime_maximum

Integer value specifying maximum number of wear time minutes for a day to be considered valid. The default is 1440, but you may want to use a lower value (e.g. 1200) if participants were instructed to remove devices for sleeping, but often did not.

active_bout_length

Integer value specifying minimum length of an active bout.

active_bout_tol

Integer value specifying number of minutes with counts outside the required range to allow during an active bout. If non-zero and active_bout_nci = FALSE, specifying non-zero values for mvpa_bout_tol_lower and vig_bout_tol_lower is highly recommended. Otherwise minutes immediately before and after an active bout will tend to be classified as part of the bout.

mvpa_bout_tol_lower

Integer value specifying lower cut-off for count values outside of required intensity range for an MVPA bout.

vig_bout_tol_lower

Integer value specifying lower cut-off for count values outside of required intensity range for a vigorous bout.

active_bout_nci

Logical value for whether to use algorithm from the NCI's SAS programs for classifying active bouts.

sed_bout_tol

Integer value specifying number of minutes with counts outside sedentary range to allow during a sedentary bout.

sed_bout_tol_maximum

Integer value specifying upper cut-off for count values outside sedentary range during a sedentary bout.

artifact_thresh

Integer value specifying the smallest count value that should be considered an artifact.

artifact_action

Integer value controlling method of correcting artifacts. Choices are 1 to exclude days with one or more artifacts, 2 to lump artifacts into non-wear time, 3 to replace artifacts with the average of neighboring count values, and 4 to take no action.

weekday_weekend

Logical value for whether to calculate averages for weekdays and weekend days separately (in addition to all valid days).

return_form

Character string controlling how variables are returned. Choices are "daily" for per-day summaries, "averages" for averages across all valid days, and "both" for a list containing both.

Value

Numeric matrix or list of two numeric matrices, depending on return_form.

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.

Examples

# Note that the 'unidata' dataset contains accelerometer data for first 5 
# subjects in NHANES 2003-2004

# Get data from ID number 21005
id.part1 <- unidata[unidata[, "seqn"] == 21005, "seqn"]
counts.part1 <- unidata[unidata[, "seqn"] == 21005, "paxinten"]

# Process data from ID 21005 and request per-day variables
accel.days <- process_uni(
  counts = counts.part1, 
  id = id.part1, 
  return_form = "daily"
)

# Repeat, but request averages across all valid days
accel.averages <- process_uni(
  counts = counts.part1, 
  id = id.part1, 
  return_form = "averages"
)
                          
# Process data according to methods used in NCI's SAS programs
accel.nci1 <- process_uni(
  counts = counts.part1, 
  id = id.part1, 
  brevity = 2, 
  valid_days = 4, 
  cpm_nci = TRUE, 
  days_distinct = TRUE, 
  nonwear_tol = 2, 
  nonwear_tol_upper = 100,
  nonwear_nci = TRUE, 
  weartime_maximum = 1440,
  active_bout_tol = 2, 
  active_bout_nci = TRUE, 
  artifact_thresh = 32767,
  artifact_action = 3, 
  return_form = "averages"
)
                          
# Repeat, but use nci_methods input for convenience
accel.nci2 <- process_uni(
  counts = counts.part1, 
  id = id.part1, 
  nci_methods = TRUE, 
  brevity = 2, 
  return_form = "averages"
)
                          
# Results are identical
all.equal(accel.nci1, accel.nci2)



[Package accelerometry version 3.1.2 Index]