I have a data set where I am interested in the regression line the best explains the upper bound of that data. As an example the subset of data 'df2' from 'df' below represents the best 4 points describing the upper bound that all the data lies under:
df <- data.frame(x = c(38, 45, 78, 88, 99, 103, 117, 117, 120, 148),
y = c(256, 226, 185, 198, 187, 89, 167, 160, 138, 85))
df2 <- data.frame(x = c(38, 88, 99, 117), y = c(256, 198, 187, 167))
plot(df)
abline(lm(y~x, df))
points(df2, pch = "x", col = "red")
abline(lm(y~x, df2), col = "red")
The nature of the data is that 4 data points on upper bound and with reasonable spread should return an R^2 > 98%. Ultimately I am interested in the x- and y-intercepts of the red regression line depicted in the plot. Any suggestion for a function or method that can achieve this would be greatly appreciated.