# Scaling of optimisation function in non-linear least squares problem

Suppose I am minimizing the following function:

$$g(\alpha)=\sum_{i=1}^n(y_i-f(x_i,\alpha))^2,$$

where $y_i$ and $x_i$ are data, $f$ is a known non-linear function and $\alpha$ parameter (of dimension larger than 1) of interest. Is it better to minimise

$$\frac{g(\alpha)}{n}$$

instead in order to guard against round-off errors, etc? In my case I get conflicting results, for some problems normalisation leads to a vast improvement in proportion of achieved convergence (I do MC simulations so I know the true value $\alpha$) in other cases not so much. Maybe there is some kind of an algorithm or a general advice when to choose the scaling and when not to?

I use R's optim function for optimisation. I tried method=Nelder-Mead, "CG" and "BFGS". Results are different for CG and BFGS and the same for Nelder-Mead. The differences are slight, but measurable especially for BFGS. Naturally I use the same starting values and the same data for each optimisation run.

• Without more information, it's not necessarily clear if scaling is a problem here. For convex least-squares problems, it is helpful to scale a problem so that the linear solves used in algorithms are well-conditioned; many solvers already do this automatically. If your problem is nonconvex and you are using a convex solver without supplying an initial guess, the solver heuristics may select different initial guesses, and converge to different local minima. – Geoff Oxberry Jul 11 '13 at 18:56
• I've updated the question with more details. I think though that my optimisation problems are ill-posed. The problem is that I'm developing a software where $f$ can be anything, so I'm trying to find the best solution probably among only the bad ones. – mpiktas Jul 12 '13 at 8:43
• Nelder-Mead isn't guaranteed to converge if your parameter vector has dimension greater than 1. Given that it uses scalar multiplications of parameters that are usually around one and vector additions/subtractions, unless your vector of parameters is very badly scaled, it's unlikely that scaling will affect it (except possibly with an absolute convergence criterion, and even then, not by much). The non-convexity of $f$ and initial guesses could still be an issue. Could you describe what you mean by "conflicting results" and give us a typical choice of $f$? If you can, be quantitative. – Geoff Oxberry Jul 12 '13 at 19:53

• I use R's optim, with method="BFGS" and scaling does lead to different estimates in my case. I suspect the problem is not with the algorithm, but with my optimisation problem. – mpiktas Jul 12 '13 at 8:18