computeActivityIndex computes the Activity Index using raw accelerometry data, based on user specified parameters such as sample rate and epoch length.

computeActivityIndex(x, x_sigma0 = NULL, sigma0 = NULL, epoch = 1, hertz)

# S3 method for default
computeActivityIndex(x, x_sigma0 = NULL, sigma0 = NULL, epoch = 1, hertz)

# S3 method for GT3XPlus
computeActivityIndex(x, x_sigma0 = NULL, sigma0 = NULL, epoch = 1, hertz)

Arguments

x

An object containing raw accelerometry data, which could either be a 4-column data frame or "GT3XPlus" object. See "Details".

x_sigma0

A 4-column data frame containing the raw accelerometry data when the device is not worn. The 1st column has the record/index number. The 2nd to 4th columns contain the tri-axial raw acceleration. The data will be used to calculate \(\bar{\sigma}_i\).

sigma0

Specify \(\bar{\sigma}_i\) directly. At least one of x_sigma0 and sigma0 must be specified. If both existed, sigma0 will be used.

epoch

The epoch length (in second) of the Activity Index. Must be a positive integer.

hertz

The sample rate of the data.

Value

A data frame with two columns. The first column has the "record number" associated with each entry of Activity Index, while the second column has the actual value of Activity Index.

Details

x could be either of the following two types of objects:

  1. A 4-column data frame containing the tri-axial raw accelerometry data in the 2nd to 4th column, and the associated record number (could be time) in the 1st column. ReadTable can be used to generate such data frame.

  2. An "GT3XPlus" object given by function ReadGT3XPlus.

Examples

library(graphics) fname = system.file("extdata", "sample_table.csv.gz", package = "ActivityIndex") sampleTable = ReadTable(fname) AI_sampleTable_x = computeActivityIndex( sampleTable, x_sigma0 = sampleTable[1004700:1005600, ], epoch = 1, hertz = 30) AI_sampleTable_x
#> Showing head and tail rows #> RecordNo AI #> 1 1 0.00000 #> 2 31 0.00000 #> 3 61 0.00000 #> 4 91 0.00000 #> 5 121 133.70797 #> 6 151 34.83663 #> RecordNo AI #> 33531 1005901 0.0000000 #> 33532 1005931 0.3625443 #> 33533 1005961 0.6685997 #> 33534 1005991 1.3031073 #> 33535 1006021 0.0000000 #> 33536 1006051 0.4027794
plot(AI ~ RecordNo, data = AI_sampleTable_x, type = "l")