1

I'd like to minimise a function like:

$$ R^2(x) = \sum_{i=1}^N (Y_i - \frac {a_i}{x \cdot c_i+b_i})^2 $$

This is similar to Ordinary Least Squares, but seems to be harder to solve because the $x$ is in the denominator.

Can this be solved?

1 Answers1

2

You have $n$ data points $(a_i,b_i,c_i,y_i)$ and you want to fit the nonlinear model $$y=\frac a {x\, c + b}$$ where $x$ is a parameter to be tuned.

So, as you wrote, the least square procedure will consist in the minimization of $$F(x)=\frac 12\sum_{i=1}^n r_i^2 \qquad \text{where} \qquad r_i=y_i-\frac{ a_i} {x\, c_i + b_i}$$ which will be solved looking for the zero of function $$G(x)=F'(x)=\sum_{i=1}^n r_i \frac {dr_i}{dx}\qquad \text{where} \qquad \frac {dr_i}{dx}=\frac{ a_i\,c_i} {(x\, c_i + b_i)^2}$$ This could be achieved using Newton method using $$G'(x)=\sum_{i=1}^n\left( \left(\frac {dr_i}{dx}\right)^2+r_i\frac {d^2r_i}{dx^2}\right)\qquad \text{where} \qquad \frac {d^2r_i}{dx^2}=-\frac{ a_i\,c_i^2} {(x\, c_i + b_i)^3}$$ Starting from a guess $x_0$, Newton method will update it according to $$x_{n+1}=x_n-\frac{G(x_n)}{G'(x_n)}$$ All of that looks simple provided a "reasonable" (not to say good) estimate of the parameter to be tuned.

To get this estimate, assume that the errors are small and rewrite, for the time being, the model as $$\frac 1{y}=\frac {x\, c + b} a\implies \frac a{y}-b=x\,c$$ which is linear with respect to $x$; from this, we can deduce the estimate $$\color{red}{x_0=\frac{\sum_{i=1}^n \left(\frac {a_i}{y_i}-b_i\right)\,c_i } {\sum_{i=1}^n c_i^2 }}$$ At this point, you are ready to go for the fine tuning of the parameter using either nonlinear regression or solving equation $G(x)=0$.

For illustration purposes, let us consider the following data set $$\left( \begin{array}{cccc} i & a_i & b_i & c_i & y_i \\ 1 & 1 & 1 & 1 & 0.22 \\ 2 & 1 & 1 & 2 & 0.13 \\ 3 & 1 & 1 & 3 & 0.09 \\ 4 & 1 & 2 & 1 & 0.18 \\ 5 & 1 & 2 & 2 & 0.11 \\ 6 & 1 & 2 & 3 & 0.08 \\ 7 & 1 & 3 & 1 & 0.15 \\ 8 & 1 & 3 & 2 & 0.10 \\ 9 & 1 & 3 & 3 & 0.07 \\ 10 & 2 & 1 & 1 & 0.45 \\ 11 & 2 & 1 & 2 & 0.25 \\ 12 & 2 & 1 & 3 & 0.18 \\ 13 & 2 & 2 & 1 & 0.37 \\ 14 & 2 & 2 & 2 & 0.22 \\ 15 & 2 & 2 & 3 & 0.16 \\ 16 & 2 & 3 & 1 & 0.31 \\ 17 & 2 & 3 & 2 & 0.20 \\ 18 & 2 & 3 & 3 & 0.15 \\ 19 & 3 & 1 & 1 & 0.67 \\ 20 & 3 & 1 & 2 & 0.38 \\ 21 & 3 & 1 & 3 & 0.26 \\ 22 & 3 & 2 & 1 & 0.55 \\ 23 & 3 & 2 & 2 & 0.34 \\ 24 & 3 & 2 & 3 & 0.24 \\ 25 & 3 & 3 & 1 & 0.46 \\ 26 & 3 & 3 & 2 & 0.30 \\ 27 & 3 & 3 & 3 & 0.22 \end{array} \right)$$ Using the method, we obtain $x_0=3.4941$ and Newton iterates will be $$\left( \begin{array}{cc} n & x_n \\ 0 & 3.494096074 \\ 1 & 3.472142899 \\ 2 & 3.472452615 \\ 3 & 3.472452678 \end{array} \right)$$ which is the solution for ten significant figures.

In fact, the data were generated using $x=3.456$ and rounded to two decimal places.

All of the above can easily be done using Excel.

  • Thanks for the detailed reply! I was wondering if something could be done better than Newton's method, but maybe not? I'm concerned about the algorithm converging to a local solution rather than the global solution. Is there any other method which can guarantee convergence to the global minima for this equation? – user3766223 Jun 17 '17 at 06:26
  • You are welcome ! Better than Newton ? Yes, if you want Halley, Householder or higher orders ... but it would probably be stupid. With this kind of problems, you will not get local minimum. Take care : we are not speaking about minimization but curve fit and this makes a difference (at least to me !). All the trick is to generate a good starting point for two reasons : less iterations and path to solution since Newton method could play yoyo if you see what I mean. If you want to discuss more, open a chat room and let me know. Cheers :-) – Claude Leibovici Jun 17 '17 at 06:33
  • Thanks Claude, I should note that although it looks like a curve fit problem, the context of what I'm doing is slightly different, and more of a minimisation problem for me. It is important that the algorithm get's the exact true minimum of x all the time. If it was a curve fit problem I would be in for a better shot because the initial guess will probably always be close enough to the true answer (assuming noise is small), but for what I'm doing the errors aren't gaussian, and can be quite large (in which case the initial guess is far off and Newton's Method might not converge). – user3766223 Jun 17 '17 at 06:56
  • @user3766223. Could you provide me the worst data set you faced ? My e-mail address is i my profile. – Claude Leibovici Jun 17 '17 at 14:07