Return to the home page.

The Ultimate Windows Math Toolbox

 

bullet Ver 3.0.697
23 June 2008
bullet Free support
bullet Only $44.85 (US)
(Professional)
Click to buy UltimaCalc Professional
bullet Only $34.85 (US)
(Standard)
Click to buy UltimaCalc Standard.

bullet Free download

<<< Prev  Next >>>

 

Nonlinear Least Squares Fit

The window for calculating a nonlinear least squares fit is more complex than the windows used for other forms of least squares fit, and therefore requires more explanation.

Options for prime numbers

Entering Data

The aim of a nonlinear least squares fit is to find the parameters of an expression that yield the best fit between (X, Y) data pairs and the value of the expression for each value of X.

The (X, Y) data pairs are entered as usual into a Data Entry control. However, it is usually more convenient to enter the data for the variables and the expression first.

The expression to fit to the data should contain at least one variable (or parameter). The variable x will represent the X component of each (X, Y) data pair. Enter the number of parameters into the control next to the 'Mode' button. The window will change appropriately.

For each parameter, enter its name and initial value. The name can be any legal variable name. (A letter followed by letters, digits, or underscore characters, avoiding the use of constants and certain names such as pi.) After performing a calculation, variables of these names will be available in UltimaCalc's main window, and they will contain the calculated values.

After clicking in the box for the first variable name, the 'Tab' key will take you through the entry boxes in a logical sequence. Use Shift+Tab to move backwards.

The image shows that a is initialised to 2, b is initialised to 10, and c is initialised to 4. These values were intelligent guesses.

Calculating the Result

After entering the names of the variables, their initial values, and the expression to minimise, enter the (X, Y) data pairs into the Data Entry control, i.e. enter an X value into the box labelled X =, hit the 'Tab' key, enter a corresponding Y value into the box labelled Y =, and hit the 'Enter' key. Once enough data points have been entered, a calculation will be attempted automatically.

It is useful to turn on the plot window (the check box at lower left). This will indicate whether the calculated result is a reasonable fit, or is hopeless.

Wrong Result?

With some expressions, there may be several 'solutions' possible, i.e. there may be local minima when the sum of the squared errors is calculated. Which minimum is found depends on the initial values of the variables. Inspection of the plot may give ideas as to how the initial values may be improved. Using the 'Copy' buttons and the 'Hold' checkboxes might help here.

The 'Copy' buttons

If a calculated value seems to be an improvement on a particular initial value, it can be used as a new initial value by clicking on the corresponding 'Copy' button.

The 'Hold' buttons

Sometimes it might help to find a solution if the value of one of the variables is held constant. To do this, click on the corresponding 'Hold' check box.

The 'Calc' button

When all the (X, Y) data pairs have been entered, use the 'Calc' button to recalculate the result after changing the inital values, or after changing the expression to be minimised.

The other buttons

The remaining buttons in this window operate the same as for other forms of regression or least squares fitting.