computeActivityIndex {ActivityIndex}R Documentation

Compute Activity Index

Description

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

Usage

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

## Default S3 method:
computeActivityIndex(x, x_sigma0 = NULL, sigma0 = NULL, epoch = 1, hertz)

## S3 method for class '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.

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.

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.

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
plot(AI ~ RecordNo, data = AI_sampleTable_x, type = "l")

[Package ActivityIndex version 0.3.7 Index]