findCutoff: Finds cutoff point on knee curve

Description Usage Arguments Value Examples

View source: R/KneeArrow.R

Description

Finds cutoff point on knee curve

Usage

1
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

1
2
3
4
5
6
7
# 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)

Example output



KneeArrower documentation built on Oct. 23, 2020, 8:07 p.m.