apply_troiano: Apply the Troiano algorithm

View source: R/apply_troiano.R

apply_troianoR Documentation

Apply the Troiano algorithm

Description

The Troiano algorithm detects periods of non-wear in activity data from an ActiGraph device. Such intervals are likely to represent invalid data and therefore should be excluded from downstream analysis. The algorithm formalizes a technique used to analyze the 2003-2004 NHANES data; the original SAS source code can be found at https://riskfactor.cancer.gov/tools/nhanes_pam/.

Usage

apply_troiano(
  agdb,
  activity_threshold = 0,
  min_period_len = 60,
  max_nonzero_count = Inf,
  spike_tolerance = 2,
  spike_stoplevel = 100,
  use_magnitude = FALSE,
  endat_nnz_seq = TRUE
)

Arguments

agdb

A tibble of activity data with an epochlength attribute. The epoch length must be 60 seconds.

activity_threshold

Highest activity level to be considered "zero"; an epoch with activity exceeding the threshold is considered a "spike". The default threshold is 0.

min_period_len

Minimum number of consecutive "zero" epoch to start a non-wear period. The default is 60.

max_nonzero_count

Epochs with activity greater than max_nonzero_count are labeled as "zero". The default is Inf.

spike_tolerance

Also known as artifactual movement interval. At most spike_tolerance "nonzero" epochs can occur in sequence during a non-wear period without interrupting it. The default is 2.

spike_stoplevel

An activity spike that exceeds spike_stoplevel counts ends a non-wear period, even if the spike tolerance has not been reached. The default is 100.

use_magnitude

Logical. If true, the magnitude of the vector (axis1, axis2, axis3) is used to measure activity; otherwise the axis1 value is used. The default is FALSE.

endat_nnz_seq

Logical. If true, a non-wear period ends with a run of nonzero epochs that is longer than spike_tolerance. This corresponds to the option "Require consecutive epochs outside of the activity threshold" in ActiLife's Wear Time Validation menu. The default is TRUE.

Details

The Troiano algorithm specifies that a non-wear period starts with min_period_len consecutive epochs/minutes of "zero" activity and ends with more than spike_tolerance epochs/minutes of "nonzero" activity.

This implementation of the algorithm expects 60s epochs.

Value

A summary tibble of the detected non-wear periods. If the activity data is grouped, then non-wear periods are detected separately for each group.

References

RP Troiano, D Berrigan, KW Dodd, LC Mâsse, T Tilert and M McDowell. Physical activity in the united states measured by accelerometer. Medicine & Science in Sports & Exercise, 40(1):181–188, 2008.

ActiLife 6 User's Manual by the ActiGraph Software Department. 04/03/2012.

See Also

apply_choi(), collapse_epochs()

Examples

library("dplyr")
data("gtxplus1day")

gtxplus1day %>%
  collapse_epochs(60) %>%
  apply_troiano()

dipetkov/actigraph.sleepr documentation built on March 25, 2022, 2:33 a.m.