Learn R Programming

healthcareai (version 1.2.4)

findElbow: Find the elbow in a curve

Description

finds the elbow of a curve that is concave to the line connecting the first and last points.

Usage

findElbow(y)

Arguments

y

A numeric vector of more than 2 elements w/o NA's

Value

A number, the index of the elbow point.

References

http://healthcare.ai

This function is developed based on the following function in package ChemoSpecMarkeR https://github.com/bryanhanson/ChemoSpecMarkeR/blob/master/R/findElbow.R

The idea behind the function can be found here https://stackoverflow.com/questions/2018178/finding-the-best-trade-off-point-on-a-curve/2022348#2022348

See Also

healthcareai

Examples

Run this code
# NOT RUN {
y <- c(8.5, 4.9, 2.8, 2.5, 1.9, 1.1, 1.1, 0.9)
plot(y) # concave
findElbow(y)

y <- c(6,5.5,4,2,1.5)
plot(y) # not concave
## findElbow(y) will gave an error
# }

Run the code above in your browser using DataLab