# Nonlinear least squares fit

I'm trying to find a least squares fit for the data above. When I plotted the data, I got

Which doesn't look very linear. Any tips for how to go about finding a least squares fit for this data? I can't seem to find any nice formulas online, like the ones that exist for linear least squares fit.

• Here is what WA finds. If you fit to an exponential, it looks bad.
– Moo
Jan 22, 2017 at 21:24
• Wow did not know that you could do that. I got the same equation for the linear least squares fit. Do you think that the linear equation is sufficient? Jan 22, 2017 at 21:28
• It looks pretty good, but I would try an interpolating polynomial to see if it provides something better, but it may not.
– Moo
Jan 22, 2017 at 21:34

Agree with @Moo's comment. Note that the linearity in linear least squares is w.r.t the parameters and not the variables. As such, you can fit plenty non linear models with it. Specifically your data looks pretty linear in $x$ as well. So I would go with maximum second order polynomial fit, i.e., $$y=\beta_0+\beta_1x+\beta_2x^2+\epsilon.$$ If you don't have a good theoretical reason to use non-linear fit, I would not bother to use it.