1
$\begingroup$

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?

$\endgroup$
2
  • $\begingroup$ What software are you using? Matlab? Excel? Maple? R? Mathematica? Python? Also check your expression, do you mean $(a-1)/(...)$ or $a-\frac{1}{...}$? $\endgroup$
    – MrYouMath
    Oct 13 '17 at 20:07
  • $\begingroup$ I'm doing it in c#. I did some experimentation with Mathematica, but I want the estimation to be done in stand-alone program, and maybe optimize the speed somewhat $\endgroup$ Oct 14 '17 at 8:55
2
$\begingroup$

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.