findCutoff: Finds cutoff point on knee curve

View source: R/KneeArrow.R

findCutoffR Documentation

Finds cutoff point on knee curve

Description

Finds cutoff point on knee curve

Usage

findCutoff(x, y, method = "first", frac.of.steepest.slope = 0.5)

Arguments

x

vector of x coordinates of points around curve

y

vector of y coordinates of points around curve

method

the method to define the knee point. Value can be "first" for first derivative cutoff or "curvature" for maximum curvature cutoff.

frac.of.steepest.slope

the slope at the cutoff point relative to the steepest (positive or negative) slope on the curve. Only used if method is set to "first". Can be set to any number > 0 or <= 1. If the knee curve is increasing and concave down, then lower numbers will lead to higher knee points, and higher numbers will lead to lower knee points.

Value

a list containing the (x, y) coordinates of the knee point chosen using the specified method

Examples

# Generate some knee data
x <- runif(100, min=-3, max=3)
y <- -exp(-x) * (1+rnorm(100)/3)
plot(x, y)
# Plot knee points calculated using two different methods
points(findCutoff(x,y), col="red", pch=20, cex=3)
points(findCutoff(x,y, method="curvature"), col="blue", pch=20, cex=3)

agentlans/KneeArrower documentation built on May 17, 2022, 7:32 p.m.