I am fitting a power law $Y = aX^b$ to a data set. There are two ways to do this:
- One is on log-scale, which means fitting $\log(Y)$ to $a_1 + b_1\log(X)$.
- In other case, using linear scale to fit $Y = a_2X^{b_2}$.
Mathematically, both should be same, with $a_1 = \log (a_2)$ and $b_1 = b_2$. However, I am getting different fitting parameters by two methods (first looking visually poor!).
Here is a working example:
Y = {{1., 4.69246}, {2., 61.9172}, {3., 428.652}, {4., 2687.97}, {5., 10869.6}};
nlm1 = NonlinearModelFit[Log[Y], a1 + b1 x, {a1, b1}, x];
nlm1["ParameterTable"]
Show[ListPlot[Y], Plot[Exp[nlm1[Log[x]]], {x, 0.5, 6}]]
nlm2 = NonlinearModelFit[Y, a2*x^b2, {a2, b2}, x];
nlm2["ParameterTable"]
Show[ListPlot[Y], Plot[nlm2[x], {x, 0.5, 6}]]