segment: Segment an FemFit dataset

Description Usage Arguments Details Value See Also Examples

View source: R/segment.r

Description

Conducts principal component analysis then fits a regression tree to the first principal component. Event terminal nodes within a JSONLabel are identified by "large" mean deviations.

Usage

1
2
3
segment(x, cp. = 0.005, numOfNodesToLabel = list(c(3, 1, 6, 3)),
  JSONLabel_Baseline = list(c("relax30s_A", "relax30s_B")),
  JSONLabel_Sequence = list(""), xval. = 100, ...)

Arguments

x

An "FemFit" object.

cp.

The complexity parameter provided to the regression tree.

numOfNodesToLabel

The number of nodes to label as events within a JSONLabel.

JSONLabel_Baseline

The JSONLabels corresponding to the definite baselines.

JSONLabel_Sequence

The JSONLabel sequence corresponding to numOfNodesToLabel. Defaults to unique(x$df$JSONLabel).

xval.

The number of cross-validations parameter provided to the regression tree.

...

Arguments passed to rpart.

Details

The elements of the list, numOfNodesToLabel, maps to each unique sessionID. The numeric vector corresponds to the number of terminal nodes to label as events within each level of JSONLabel, where the numeric vector maps to JSONLabel_Sequence.

cp., numOfNodesToLabel, JSONLabel_Baseline, JSONLabel_Sequence, and xval. are recylced to the length of unique(x$df$sessionID). ... arguments are not vectorised.

The length of the numeric vector depends on the number of non-JSONLabel_Baseline device labels.

Value

Updates the errorSummary element found in the "FemFit" object. This contains a list of terminal nodes with their assigned label and timestamps.

See Also

prcomp and rpart for how the main statistical learning components work.

segmentRefine_pcurve and segmentRefine_protocol for functions to identifiy events in noisy pressure traces post-segmentation.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
# Read in the FemFit data
AS005 = read_FemFit(c(
        "Datasets_AukRepeat/61aa0782289af385_283_csv.zip",
        "Datasets_AukRepeat/61aa0782289af385_284_csv.zip"
    ),
    remove.NAs = TRUE
  )

# Segment the FemFit data
AS005 = segment(
    x = AS005
    # Use the same control parameter for both sessions
    cp. = 0.001,
    # Define a different set in the number of terminal nodes to edit for each session
    numOfNodesToLabel = list(c(3, 1, 3, 4), c(4, 1, 5, 3)),
    # Set the baseline JSONLabels. segment() will look for both "relax30s_A" and "relax30s_B" in each session
    JSONLabel_Baseline = list(c("relax30s_A", "relax30s_B")),
    # Works in conjunction with the numOfNodesToLabel argument.
    # segment() will assume that the order of protocol is unique(AS005$df$JSONLabel), excluding the baseline JSONLabels
    JSONLabel_Sequence = list("")
  )

TheGreatGospel/IVPSA documentation built on May 19, 2019, 1:47 a.m.