fragmentation {ActFrag} R Documentation

## Fragmentation Metrics

### Description

Fragmentation methods to study the transition between two states, e.g. sedentary v.s. active.

### Usage

```fragmentation(
x,
w,
thresh,
bout.length = 1,
metrics = c("mean_bout", "TP", "Gini", "power", "hazard", "all")
)
```

### Arguments

 `x` `integer` `vector` of activity data. `w` `vector` of wear flag data with same dimension as `x`. `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".

### 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 list with elements

 `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

### References

Junrui Di, Andrew Leroux, Jacek Urbanek, Ravi Varadhan, Adam P. Spira, Jennifer Schrack, Vadim Zipunnikov. Patterns of sedentary and active time accumulation are associated with mortality in US adults: The NHANES study. bioRxiv 182337; doi: https://doi.org/10.1101/182337

### Examples

```data(example_activity_data)
count1 = c(t(example_activity_data\$count[1,-c(1,2)]))
wear1 = c(t(example_activity_data\$wear[1,-c(1,2)]))
frag = fragmentation(x = count1, w = wear1, thresh = 100, bout.length = 1, metrics = "mean_bout")

```

[Package ActFrag version 0.1.1 Index]