0

I need to perform linearization of the function $axe^{-bx}$ in order to perform least squares fitting algorithm. The closest to linear I got is this: $\ln{y}-\ln{x}=\ln{a}+\beta x$ .

I tried to google it and found this old post. It is written here that $\ln{y}-\ln{x}=\ln{a}+\beta x$ is linear, and if we want it to fit into the form of $y'=mx'+b$ , we can just take: $y'=\ln{y}-\ln{x} , b=\ln{a} , x'=x , m=\beta $.
But as far as I know, $y'$ needs to be a function of $y$, without any more variables. So how could this be possible to take $y'=\ln{y}-\ln{x}$ here?
And if this indeed incorrect as I think, is there a way for linearize this function?

John
  • 341

3 Answers3

1

The suggestion you're following goes like this: given your data points $(x_k,y_k)$, consider the data set $(x_k,\ln(y_k)-\ln(x_k))$. Fit this data set to a linear function $L$. Then consider your fit to the original data to be $y=e^{\ln(x)+L(x)}=xe^{L(x)}$. This works because if $y=axe^{-bx}$ then $\ln(y)-\ln(x)=\ln(a)-bx$, and the right side is a linear function of $x$.

The problem I have with this formulation is that its error metric is not based only on "vertical" residuals, like in the ordinary linear case or in the most familiar exponential fitting case. The residuals will involve $x,y$ together. This may not be appropriate in your application, for example if the $x$ data is known to be exact and the $y$ data is not.

In this situation I'd be inclined to just use nonlinear least squares. This is necessarily an iterative technique, but that's fine, it should converge easily unless your data set very poorly matches the fit or is very large.

Ian
  • 101,645
0

By "linearization" I would assume they mean at a point, say, $(c,ace^{-bc})$. Then the linearization could be taken to be $y= (a-abc)e^{-bc}(x-c)+ace^{-bc}$. This comes from $y= f'(x_1)(x-x_1)+f(x_1)$.

0

You have $n$ data points $(x_i,y_i)$ (for $i=1,2,\cdots,n$) and you wanr to fit the model $$y=a\,x\,e^{-bx}$$ which is nonlinear with respect to parameters; so nonlinear regression will be required. But using nonlinear regression implies that you need (in most cases) to provide "reasonable" estimates of the searched parameters. This is why, when possible, we try to linearize the model.

In the given case, let us define $z_i=\frac {y_i}{x_i}$. Then, the model becomes $$z=a \,e^{-bx}\implies \log(z)=\log(a)-bx=c + dx$$ Define $t_i=\log(z_i)$ and the model becomes $$t=c+dx$$ which is simple and a trivial linear regression will provide $c$ and $d$.

From here, we the have $a=e^c$ and $b=-d$. These are only estimates. From here, you now need nonlinear regression because what is measured is $y_i$ and nothing else (neither $z_i$ nor $t_i$).

For illustration purposes, let us consider the following data points $$\left( \begin{array}{cc} x_i & y_i \\ 2 & 150 \\ 3 & 180 \\ 4 & 190 \\ 5 & 190 \\ 6 & 180 \\ 7 & 160 \\ 8 & 150 \\ 9 & 130 \\ 10 & 110 \\ 11 & 100 \\ 12 & 80 \end{array} \right)$$

This will generate the following values $$\left( \begin{array}{cccc} x_i & y_i & z_i & t_i\\ 2 & 150 & 75. & 4.31749 \\ 3 & 180 & 60. & 4.09434 \\ 4 & 190 & 47.5 & 3.86073 \\ 5 & 190 & 38. & 3.63759 \\ 6 & 180 & 30. & 3.40120 \\ 7 & 160 & 22.8571 & 3.12926 \\ 8 & 150 & 18.75 & 2.93119 \\ 9 & 130 & 14.4444 & 2.67031 \\ 10 & 110 & 11. & 2.39790 \\ 11 & 100 & 9.09091 & 2.20727 \\ 12 & 80 & 6.66667 & 1.89712 \end{array} \right)$$

The linear regression leads to $$t=4.82315 -0.240393 x \implies a=124.356 \qquad b=0.240$$ Starting with these estimates, the nonlinear regression will give $$y=123.537\,x\, e^{-0.238825 x}$$

  • But you defined the parameter t to be a function of z, which is a function of y and x. So t is a function of y and x, and therefore I don't understand why the model you built (t=c+dx) is linear. As far as I know, the parameter t you defined here must be a function of y only (and it can not include any other function parameters, like x). So why is it ok to define t like that? – John Jan 11 '17 at 11:23
  • I just gave the intermediate steps. You could directly define $t_i=\log(\frac{y_i}{x_i})$ which makes the model to be linear. Try with a plot. – Claude Leibovici Jan 11 '17 at 11:29
  • But as I said, t is a function of x and y. As far as I know, it can only be a function of y in order the model you provided will be linear. Why is it ok to define as a function of x and y? – John Jan 11 '17 at 11:59
  • @John It depends what you mean by "OK". This approach is "linear" in the sense that upon transformation you are performing ordinary linear regression, and it is "consistent" in the sense that if the data lies exactly on a curve $y=axe^{-bx}$ then such $a,b$ will be found exactly by this technique. Beyond that the meaning of "OK" depends on your own modeling decisions. – Ian Jan 11 '17 at 13:12
  • @John (Cont.) As Claude and I both mentioned, it is often desirable for your error metric to depend only on discrepancies between the fitted values of $y$ and the measured values of $y$. If you want to find an optimal fit to a curve of your form in a metric like that, then you're going to need nonlinear regression. (Note that special functions don't really help, because of the non-injectivity issue that I mentioned in my answer.) – Ian Jan 11 '17 at 13:14
  • @ClaudeLeibovici Why are the $a$ and $b$ values of the last linear function not the same with the values of $a$ and $b$ you found? – Lars Smith Dec 11 '22 at 00:26
  • @LarsSmith. Because the first come from the linearization; they are just estimates of the final. – Claude Leibovici Dec 11 '22 at 03:28
  • @ClaudeLeibovici Thank you, but I really don't understand how you get to the final values, could you please explain? – Lars Smith Dec 11 '22 at 12:31
  • @LarsSmith. I wrote it : the second and final step invokes a nonlinear regression which must be done since what is measured is $y$ and not any of its possible transform leading to a linearized model – Claude Leibovici Dec 12 '22 at 04:52