fragmentation_long: Fragmentation Metrics for Whole Dataset

Description Usage Arguments Details Value Examples

View source: R/fragmentation_long.R

Description

Fragmentation methods to study the transition between two states, e.g. sedentary v.s. active.This function is a whole dataset wrapper for fragmentation

Usage

1
2
3
fragmentation_long(count.data, weartime, thresh, bout.length = 1,
  metrics = c("mean_bout", "TP", "Gini", "power", "hazard", "all"),
  by = c("day", "subject"))

Arguments

count.data

data.frame of dimension n*1442 containing the 1440 minute activity data for all n subject days. The first two columns have to be ID and Day.

weartime

data.frame with dimension of count.data. The first two columns have to be ID and Day.

thresh

threshold to binarize the data.

bout.length

minimum duration of defining an active bout; defaults to 1.

metrics

What is the fragmentation metrics to exract. Can be "mean_bout","TP","Gini","power","hazard",or all the above metrics "all".

by

Determine whether fragmentation is calcualted by day or by subjects (i.e. aggregate bouts across days). by-subject is recommended to gain more power.

Details

Metrics include mean_bout (mean bout duration), TP (between states transition probability), Gini (gini index), power (alapha parameter for power law distribution) hazard (average hazard function)

Value

A dataframe with some of the following columns

ID

identifier of the person

Day

indicator of which day of activity it is, can be a numeric vector of sequence 1,2,... or a string of date

mean_r

mean sedentary bout duration

mean_a

mean active bout duration

SATP

sedentary to active transition probability

ASTP

bactive to sedentary transition probability

Gini_r

Gini index for active bout

Gini_a

Gini index for sedentary bout

h_r

hazard function for sedentary bout

h_a

hazard function for active bout

alpha_r

power law parameter for sedentary bout

alpha_a

power law parameter for active bout

Examples

1
2
3
4
5
6
7
8
9
data(example_activity_data)
count = example_activity_data$count
wear = example_activity_data$wear
frag_by_subject = fragmentation_long(count.data = count,
weartime = wear,thresh = 100,bout.length = 1,
metrics = "all",by = "subject")
frag_by_day = fragmentation_long(count.data = count,
weartime = wear,thresh = 100,bout.length = 1,
metrics = "all",by = "day")

junruidi/actigraphy documentation built on Sept. 25, 2019, 7:48 a.m.