Learn R Programming

GGIR (version 3.4-0)

identify_levels_ExtFunType: Identify Bouts for External Function Type Classifications

Description

Identifies bouts for epoch-by-epoch categorical classifications generated by external functions with reporttype = "type" in GGIR Part 5.

The function converts the external function type information stored in the Part 5 time series into a representation suitable for subsequent summary analysis. It creates epoch-level type durations and identifies bouts for each classification type according to the specified bout duration, bout criterion, and type priority.

Usage

identify_levels_ExtFunType(ts, myfun, ws3)

Value

A list containing:

TLEVELS

A nested list keyed first by external-function output column and then by classification level. Each leaf is a matrix with one row for each bout-duration definition and one column for each epoch. Values of 1 indicate epochs included in the corresponding bout.

TOLEVELS

A named list with one matrix per external-function output column. Each matrix contains the number of seconds in each epoch assigned to each classification level; rows represent epochs and columns represent levels.

Tnames

A character vector containing the names corresponding to the bout definitions stored in TLEVELS.

Arguments

ts

Data frame containing the Part 5 epoch-level time series, including the columns generated for external function type classifications.

myfun

List defining the external function. The function uses reporttype, colnames, tbout.dur, tbout.criter, and tbout.order when available.

ws3

Numeric value specifying the epoch duration in seconds.

Author

Vincent T van Hees <[email protected]> Jairo H Migueles <[email protected]>

Details

The function is used internally by identify_levels when an external function has reporttype = "type".

Type classifications are represented using the ExtFunType_*_s columns in ts. Original classification labels, including case, are preserved. Values supplied through tbout.order are matched to those labels case-insensitively.

If tbout.dur is not specified, the default bout durations are c(1, 5, 10) minutes. If tbout.criter is not specified, the default bout criterion is 0.8. If tbout.order is not specified, the classification types are ordered alphabetically.

Bout durations are processed from longest to shortest. When multiple classification types overlap, the order specified by tbout.order determines the priority with which epochs are assigned to bouts.

The function does not split bouts according to sleep period time or daytime. The resulting bout masks can therefore span these boundaries and are subsequently restricted to the relevant period during Part 5 analysis.

The function is intended to be called internally and is not normally called directly by users.

See Also

identify_levels, g.part5_analyseSegment_ExtFunType