# Summary

QNFIT: a curve fitting program for advanced users

This program is for those who have a good understanding of constrained, weighted least squares curve fitting, and wish to take control of the optimisation process. It is definitely not a program for beginners. The basic version just uses a quasi-Newton method to fit one or more functions of one or several variables, or a single ordinary differential equations, where the equations are taken from a dynamic link library, or from an ASCII text file that you supply, as described in program USERMOD. Some versions provide options to use alternative optimisation methods, such as LM, modified Gauss-Newton, or SQP.

After a model has been fitted, there are then options for goodness of fit, plotting, extrapolation, graphical deconvolution, storing objective function values, parameters and covariance matrices for model discrimination, and using the best fit model for calibration, or estimating derivatives and areas under the best fit curve.

Problems such as failure to converge, finding local minima or slow running may happen with four or more parameters, functions of several variables, or particularly differential equations. To avoid such problems you must have good data and weights, and you must understand the mathematics of the model selected.

In EXPERT mode you can put parameter starting estimates and limits on your data file, and this is how QNFIT should be used for single functions. For examples just inspect the test files qnfit.tf1, qnfit.tf2 and qnfit.tf3. To see how to supply parameters from files, inspect qnfit.tfl. This is a library file referencing several parameter limits files. Ideally you would construct your own library of parameter limits files from which you can select appropriate starting estimates and parameter limits. In all cases you need good starting estimates. This program uses your starting estimates as a diagonal matrix to scale the parameters, i.e.

         external_p(i) = starting estimate(i)*internal_p(i).

It is possible to use a random search before commencing a fitting session, but this should only be regarded as a soft option and should not be used where random parameter values can lead to singularities, say with exponential models, or bifurcations with differential equations. Initial values can be regarded as parameters to be estimated with differential equations, but this should be avoided if at all possible, as it greatly compounds the difficulties of fitting.

A special convention is required for fiting differential equations. Here the last parameter must be the initial condition y0 = f(0), that is, the function value at x = 0. If possible, this should be fixed and not varied, as numerous problems arise when advancing the solution from a different starting point at each iteration. So you must have x >= 0 with differential equations and, even if your data start at x > 0, the last parameter will still be used as y0 = f(0). Any attempt to fit data with x < 0, or to extrapolate with x < 0 for calibration or calculating areas or derivatives, etc., will simply generate all f(i) = y0. Note that program DEQSOL can be used for sytems of differential equations.

Back to Help Menu or End Help