# The best choice of fitting function for the data

I got a set of data points shown in the following figure:

I need to fit this dataset to interpolate and extrapolate some new data points. What is the best choice of the fitting function for this set?

• It depends, what is the purpose for the fit? If it is just to model in the domain $0\leq x\leq8$ then just use a high degree polynomial, $ax^5+bx^4+cx^3+dx^2+fx+g$ or something of that sort. If you want to limit the number of fitting parameters, maybe try a sinusoidal fit or 3rd degree polynomial. I can't think of anything perfect of the top of my head, though. If you have any context for where the data comes from maybe. – Robbie Jun 1 '18 at 19:40
• en.wikipedia.org/wiki/Lagrange_polynomial – MalayTheDynamo Jun 1 '18 at 19:42
• I see, Thanks for your comment.@RobbieVanDerzee – Sizhe Jun 1 '18 at 19:47
• Using a high degree polynomial tends to induce oscillation between the data points. If you want a single function a third or fourth degree least squares fit seems reasonable. You can also use a spline fit. It will go exactly through the points but be smooth in between. Both are covered in any numerical analysis text. – Ross Millikan Jun 1 '18 at 21:32
• If fitting a polynomial you will also want a regularizer of some sort because of what Ross writes. – mathreadler Jun 2 '18 at 8:08