How to find optimal function to minimize the distance to a set of points

121 Views Asked by At

I've been working on a side project and I had to gather some data to look for a pattern. I need to find the optimal function that minimizes the Y distance for all the points in the dataset, and so far I used Geogebra to generate both a Polynomial Regression (degree 4) and a Linear Regression. However, I'm not positive whether using regression is the correct/best way to do so, as I've never worked with them.

The function I ended up using is a mix of both of them (for x <= 80, polynomial regression, else, linear regression).

This is what the graph looks like

enter image description here

(note: only the blue points are counted, the other ones are older/not accurate)

Is there any better way to optimize this function or any other method I could use to achieve better results?

1

There are 1 best solutions below

0
On

You can solve this $L_1$ regression problem via linear programming. See problem L1 in this example.