Skip to contents

Determines which extrema should be considered spurious using various criteria. Provides more sophisticated classification than a simple hop_idx threshold.

Usage

classify.spurious.extrema(
  hop_indices,
  values = NULL,
  method = c("threshold", "quantile", "outlier", "combined"),
  threshold = 2,
  quantile_level = 0.25,
  verbose = FALSE
)

Arguments

hop_indices

Numeric vector of hop indices for all extrema

values

Optional numeric vector of function values at extrema

method

Character string specifying classification method:

  • "threshold": hop_idx <= threshold (default, backward compatible)

  • "quantile": hop_idx <= quantile(hop_idx, probs = quantile_level)

  • "outlier": statistical outlier detection based on hop_idx distribution

  • "combined": uses both threshold and relative criteria

threshold

Numeric threshold for "threshold" and "combined" methods (default 2)

quantile_level

Quantile level for "quantile" method (default 0.25)

verbose

Logical; print diagnostic information (default FALSE)

Value

Logical vector indicating which extrema are spurious

Examples

hop_indices <- c(1, 2, 4, Inf, 7)
values <- c(-1.2, 0.3, 2.1, 3.4, 2.8)
classify.spurious.extrema(hop_indices, method = "threshold", threshold = 2)
classify.spurious.extrema(hop_indices, method = "quantile", quantile_level = 0.25)
classify.spurious.extrema(hop_indices, values, method = "combined")