Basic fitting question

71 Views Asked by At

If the data (Y and X) is to be fit by a function of the type $f(x)=e^{ax}$ and I fit the Y vs. log(X) via f, and obtain the fit parameter $a$, is this $a$ parameter different than the desired one (in f(x)) even though i fit Y vs. log(X) instead of Y vs. X?

Or do I have to transform the parameter somehow?

2

There are 2 best solutions below

3
On BEST ANSWER

If you have $n$ data points $(x_i,y_i)$ and you want to fit accodring to the model $$y=e^{ax}$$ you must notice that the model is nonlinear with respect to the parameter. This means that nonlinear regression is required and then an initial estimate is required.

Writing $$\log(y)=a_1 x$$ makes the model linear and the resulting parameter is given by $$a_1=\frac{\sum_{i=1}^n x_i \log(y_i) } { \sum_{i=1}^n x_i^2}$$ but this is just an estimate resulting from the minimization of $$SSQ_1=\sum_{i=1}^n (a_1x_i-\log(y_i))^2$$ while, since what is measured is $y_i$ and not $\log(y_i)$, what you want to minimize is $$SSQ_2=\sum_{i=1}^n (e^{a_2x_i}-y_i)^2$$ Except if the data do not contain any noise $a_2\neq a_1$.

For llustration purposes, let us consider the following data set $$\left( \begin{array}{cc} x_i & y_i \\ 1 & 2 \\ 2 & 3 \\ 3 & 4 \\ 4 & 7 \\ 5 & 10 \\ 6 & 16 \\ 7 & 25 \\ 8 & 39 \\ 9 & 61 \\ 10 & 96 \end{array} \right)$$

The first step will lead to $a_1=0.460944$; using this estimate and stating the nonlinear regression, we should arrive to $a_2=0.456749$.

4
On

I think you may have meant log(Y) not log(X)

You are trying to find a function $f(x)$ in the form $e^{ax}$ such that $f(X)\approx Y$. Instead, you found a function $g(x)$ such that $g(\log(X))\approx Y$, i.e. $g(\log(X))\approx f(X)=e^{aX}\implies \frac{\log(g(\log(x)))}{x}=a.$

If you did in fact mean log(Y) instead of log(X), you found a function $g(x)$ such that $g(X)\approx \log(Y)$, i.e. $e^{g(X)}\approx Y \approx f(X) = e^{aX}\implies g(x)=a\cdot x$ (the same $a$).