 # Set S of coordinates (x,y), and am estimating f(x)=ax+b where a>0. ∀x,y((x,y)∈S⟹y<f(x)). pominjaneh6 2022-08-12 Answered
set $S$ of coordinates $\left(x,y\right)$, and am estimating $f\left(x\right)=ax+b$ where $a>0$. I also happen to know that $\mathrm{\forall }x,y\left(\left(x,y\right)\in S\phantom{\rule{thickmathspace}{0ex}}⟹\phantom{\rule{thickmathspace}{0ex}}y.
The question is how I can utilize this knowledge of the upper bound on values to improve the regression result?
My intuition is to run a "normal" linear regression on all coordinates in $S$ giving $g\left(x\right)$ and then construct ${g}^{\prime }\left(x\right)=g\left(x\right)+c$, with $c$ being the lowest number such that $\mathrm{\forall }x,y\left(\left(x,y\right)\in S\phantom{\rule{thickmathspace}{0ex}}⟹\phantom{\rule{thickmathspace}{0ex}}y\le {g}^{\prime }\left(x\right)\right)$, e.g. such that ${g}^{\prime }\left(x\right)$ lies as high as it can whilst still touching at least point in $S$. I do, however, have absolutely no idea if this is the best way to do it, nor how to devise an algorithm that does this efficiently.
You can still ask an expert for help

• Live experts 24/7
• Questions are typically answered in as fast as 30 minutes
• Personalized clear answers

Solve your problem for the price of one coffee

• Math expert for every subject
• Pay only if we can solve it Kody Larsen
Your suggestion to do an ordinary regression and then move it up is a fine way to go about it. This is pretty easy, especially if you have a decent statistics library:
1. Fit the regression.
2. Calculate the residuals, the difference between the y coordinate of each point and the y coordinate of the line at that point, given by ${\stackrel{^}{\beta }}_{0}+{\stackrel{^}{\beta }}_{1}{x}_{i}$, where ${x}_{i}$ is the ${x}_{}$ coordinate of the point. There may be a built-in way to do this. There are matrix-algebra representations as well.
3. Find the largest residual. Not largest in absolute value, just straight-up largest.
4. Add the value of the largest residual to the intercept ${\stackrel{^}{\beta }}_{0}$ of your regression model.
Your regression line now passes through the highest point and is above all the other points.