How do I fit a non-linear function to data?

77 Views Asked by At

I have a function which looks like this:

f[x] = a-1/(b Exp[x]+ c x^2 + d x +e)

I have a number of data points. I need to be able to find {a,b,c,d,e} to fit the data as fast as possible (in terms of computing speed). What is the best way to do this?

1

There are 1 best solutions below

0
On BEST ANSWER

You have $n$ data points $(x_i,y_i)$ and you want to fit the nonlinear model $$y=a -\frac 1 {b e^x+c x^2+d x+e}$$ and, as usual, you need good (or at least consistent) estimates of the parameters.

The easiest would be to assign $a$ an arbitrary value and define $\color{red}{z_i=\frac 1{a-y_i}}$

So, the model reduces to $$z= {b e^x+c x^2+d x+e}$$ So, for the given value of $a$, multilinear regression gives you parameters $b,c,d,e$ which all depend on $a$. Now, compute again the predicted $y$'s and the corresponding sum of squares $$SSQ(a)=\sum_{i=1}^n \left(a -\frac 1 {b e^{x_i}+c x_i^2+d x_i+e} \right)^2$$ Try a few values of $a$ and plot the function $SSQ(a)$ as a function of $a$. You will notice an area where it goes through a minimum; you do not need to be accurate at all. For this close to optimal value, you have the values of all remaining parameters.

Using these estimates, run the nonlinear regression. It will converge if few iterations.