please give me an advice.
I have points ("data", x and y coordinates). For these points, I created a residual function
function = LinearModelFit [dat, x, x]
Now I have to determine the point that has the smallest and largest distance from this line. And also a point that lies on a straight line. Unfortunately, I don't know how to do it. I only know how to calculate the smallest / largest distance (Min [function ["FitResiduals"]]) or Max [function ["FitResiduals"]]. But I would now need to see the given point with the corresponding coordinates (eg [0.2, 5])
Thank you for your answer
Ordering[function["FitResiduals"], 1]to find the position of the smallest residual and then use that position to find the corresponding point indat. You can useOrdering[..., -1]to find the position of the largest residual in the same manner. – Sjoerd Smit Apr 30 '21 at 08:40MinimalByandMaximalBywould work. – Roman Apr 30 '21 at 09:07