Skip to contents

Identifies the first major drop ("elbow") in a sorted vector of values, using a smoothed difference approach.

Usage

FindTier1Models(values, fold)

Arguments

values

Numeric vector. Typically sorted (e.g., decreasing likelihoods or scores).

fold

Numeric. Multiplicative factor for the median drop to define a significant elbow (e.g., 1.5).

Value

Integer. The index of the first major drop ("elbow") in the values vector.

Details

Uses a rolling mean of negative differences to smooth noise and find the first drop exceeding fold times the median drop. If no such drop is found, uses the geometric "elbow" method as a fallback.

Examples

set.seed(1)
vals <- sort(runif(20, 0, 10), decreasing = TRUE)
FindTier1Models(vals, fold = 1.5)
#> [1] 11