2
$\begingroup$

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")

enter image description here

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.

$\endgroup$
3
  • $\begingroup$ One approach to this sort of thing is quantile regression (though in very large samples it won't be as efficient as other possible approaches). See the brief mention of quantile regression in relation to a lower bound here and the discussion of quantile regression for a 90th percentile upper bound here $\endgroup$
    – Glen_b
    Commented Jan 6, 2017 at 5:15
  • $\begingroup$ Thanks @Glen_b ♦, with the percentile set to >99 I seem to get exactly what I am looking for. A whole new world of regression just opened up to me! If you would like to answer the question I will vote it up. $\endgroup$ Commented Jan 6, 2017 at 9:32
  • $\begingroup$ I've been debating whether it's perhaps close enough to one of those two posts I linked above to regard as a duplicate (though if you answered it yourself there would be little lost whether it closed or not). I'm glad it helped at least. $\endgroup$
    – Glen_b
    Commented Jan 6, 2017 at 10:26

0

Browse other questions tagged or ask your own question.