It detects outliers based on prediction bands for the given level of confidence provided.

detect_outliers(
  .data,
  test_type = c("incremental", "kinetics"),
  vo2_column = "VO2",
  cleaning_level = 0.95,
  cleaning_baseline_fit,
  protocol_n_transitions,
  protocol_baseline_length,
  protocol_transition_length,
  method_incremental = c("linear", "anomaly"),
  verbose = TRUE
)

Arguments

.data

Data retrieved from read_data() for a kinetics test, or the data retrieved from incremental_normalize() for a incremental test.

test_type

The test to be analyzed. Either 'incremental' or 'kinetics'.

vo2_column

The name (quoted) of the column containing the absolute oxygen uptake (VO2) data. Default to VO2.

cleaning_level

A numeric scalar between 0 and 1 giving the confidence level for the intervals to be calculated. Default to 0.95.

cleaning_baseline_fit

A vector of the same length as the number in protocol_n_transitions, indicating what kind of fit to perform for each baseline. Vector accepts characters either 'linear' or 'exponential'.

protocol_n_transitions

Number of transitions performed.

protocol_baseline_length

The length of the baseline (in seconds).

protocol_transition_length

The length of the transition (in seconds).

method_incremental

The method to be used in detecting outliers from the incremental test. Either 'linear' or 'anomaly'. See Details.

verbose

A boolean indicating whether messages should be printed in the console. Default to TRUE.

Value

a tibble

Details

TODO

Examples

## get file path from example data path_example <- system.file("example_cosmed.xlsx", package = "whippr") ## read data df <- read_data(path = path_example, metabolic_cart = "cosmed") ## detect outliers data_outliers <- detect_outliers( .data = df, test_type = "kinetics", vo2_column = "VO2", cleaning_level = 0.95, cleaning_baseline_fit = c("linear", "exponential", "exponential"), protocol_n_transitions = 3, protocol_baseline_length = 360, protocol_transition_length = 360, verbose = TRUE )
#> Detecting outliers
#> 14 outlier(s) found in transition 1
#> 15 outlier(s) found in transition 2
#> 13 outlier(s) found in transition 3