Wolfram Exponential Fit not match as formulas

158 Views Asked by At

I am using WolframAlpha Exponential-Fit formulas to find equation of Exponential Regression

http://mathworld.wolfram.com/LeastSquaresFittingExponential.html

but after implementation, I tested with a simple set x,y pair : [{1,2},{3,4},{5,6}]

My app result :

A = 1.59431... , B = 0.27465...

While WolframAlpha double check with calculation expression :

http://www.wolframalpha.com/input/?i=exponential+fit+%7B%7B1%2C2%7D%2C%7B3%2C4%7D%2C%7B5%2C6%7D%7D

have different results :

A = 1.75135 , B = 0.24929

I full checked my code and can make sure, I followed formulas from WolframAlpha

Someone can guide me what wrong I am

1

There are 1 best solutions below

8
On BEST ANSWER

This is a normal and classical situation. Say that your model is $$y=e^{a+b x}$$ This model is nonlinear with respect to its parameters but you can linearize it writing $$\log(y)=a+bx$$ which is linear. Applied to your data points, this leads to $$\log(y)=0.466441+0.274653 x$$ which corresponds to the minimization of the sum of squares on the logarithms of $y$. If you use these values as starting guesses for the non linear fit, you obtain $$y=e^{0.560384+0.249292 x}$$ which corresponds to the minimization of the sum of squares on $y$ which can be very different.

What the document you refer to shows is how to do the first step. What Wolfram Alpha does corresponds to the second step which is the correct one.

If you compute the sum of squares on the $y$'s, the first model leads to $0.230271$ while the second model leads to $0.159576$ which is much better.