Nonlinear LS regression

182 Views Asked by At

• Problem formulation
I have to fit the following nonlinear model to a dataset:

$$f(x)=\frac{C_1 \cdot a}{a^2 + C_2 \cdot x^2}$$

$a$: fitting parameter
$C_1, C_2$: Given constants

I can't apply standard LS-fitting as the problem is nonlinear and I don't see a way to convert it to a linear problem.

• What I have tried so far:
My approach is to formulate a minimization problem: $$a=argmin(\sum_{i=0}^N abs(f_i-f(x_i))^2 )$$ Where $f(x_i)$ is my fitting function evaluated at point $x_i$ and $f_i$ is the corresponding function value from the dataset. Then I'd apply an iterative method such as Gradient/Newton descent to find $a$. Alternatively I'd apply RANSAC to fit the model but both methods are iterative and probably too slow.

Is there a way I could linearize this model or a different method I could apply?

2

There are 2 best solutions below

2
On BEST ANSWER

Transform the data by letting $x'=x^2$, $g(x')=\frac{1}{f(x')}$. Then you have $$g(x')=\frac{a}{C_1}+\frac{C_2}{C_1a}x'$$ Let $m=\frac{a}{C_1}$ and $b=\frac{C_2}{C_1a}$ and you have a standard linear regression with parameters m and b.

1
On

This is not an answer but it is probably too long for a comment.

What Paul answered is the nice way for making the model linear and to get a manner to estimate the fitting parameter $a$.

From the slope, you have one estimate $a_1=m C_1$ and another from the intercept $a_2=\frac{C_2}{b\,C_1}$ and you can be sure (except if no noise at all in the data) that $a_1 \neq a_2$.

But you must remember that what is measured is $f(x_i)$ and not $\frac 1 {f(x_i)}$. So, the nonlinear regression must be performed starting from an estimate generated in some manner as a function of $a_1$ and $a_2$ (arithmetic or geometric mean for example).

You can use an optimizer since you want to minimize

$$\Phi(a)=\sum _{i=1}^n \left(\frac{a\, C_1}{a^2+C_2\, x(i)^2}-y(i)\right)^2$$ or an equation solver for $$\Phi'(a)=-2 \sum _{i=1}^n \frac{C_1 \left(a^2-C_2\, x(i)^2\right)}{\left(a^2+C_2\, x(i)^2\right)^2}\left(\frac{a\, C_1}{a^2+C_2\, x(i)^2}-y(i)\right)=0$$

You could save computer time if, from beginning, you define $z(i)=x(i)^2$.