PreviousTable of ContentsNext


The Brent Option

When the data have errors in both coordinates, the fitter uses an "effective variance" algorithm. In general, this introduces a slight non-linearity in the fit, and so the program must iterate to a solution.

When the fit is to a straight line, however, the non-linearity can be avoided using a technique called Brent minimisation. For further information on this algorithm, see Press and Teukolsky, Comp. in Physics 6, (1992), p. 274.

For fitting to a straight line, if there are errors in both coordinates and the ReturnCovariance option discussed below is set to False (its default) then by default LinearFit uses a Brent minimization algorithm. The relevant part of the Option screen looks like this:

Brent

Automatic (default)
False

When set to Automatic, the default, if the data has errors in both coordinates and the fit is to a straight line with powers 0 and 1 and ReturnCovariance is set to False, its default, then a Brent minimisation is used to perform the fit. When set to False then the standard effective variance method is used.

If Brent minimisation is used for the fit then the Method option only affects the initial guess of fit parameters; when set to False then the Method option controls every iteration of the fit. If Brent minimisation is used for the fit, the tolerance of the result is controlled by the BrentTolerance option.

We illustrate by fitting some synthetic data by Pearson and York to a straight line:

 A0 = 5.48 ± 0.28
A1 = -0.481 ± 0.058
Chi Squared = 11.8237 for 8 Degrees of Freedom
(Chi-squared probability: 15.924)
[Graphics:../Images/index_gr_18.gif]

The algorithm used here differs from the "standard" one that we see in many references, in which one simply iterates the solution recalculating the effective variance at each iteration. This "standard" technique may be used by setting Brent to False:

Brent

Automatic (default)
False

When set to Automatic, the default, if the data has errors in both coordinates and the fit is to a straight line with powers 0 and 1 and ReturnCovariance is set to False, its default, then a Brent minimisation is used to perform the fit. When set to False then the standard effective variance method is used.

If Brent minimisation is used for the fit then the Method option only affects the initial guess of fit parameters; when set to False then the Method option controls every iteration of the fit. If Brent minimisation is used for the fit, the tolerance of the result is controlled by the BrentTolerance option.

For this data, the exact solutions to the fit are known. The table summarises the previously shown fit, the results of fitting the data using the non-Brent method, and the exact solutions:

Brent = Automatic Brent = False Exact Solutions
A0 = 5.48 ± 0.28
A1 = -0.481 ± 0.058
Chi Squared = 11.8237
A0 = 5.40 ± 0.30
A1 = -0.464 ± 0.058
Chi Squared = 11.9128
A0 = 5.47991025
A1 = -.480533415

Notice that both methods return the same values within their claimed errors, and they are both within errors of the exact values, although the Brent algorithm gives results that are closer.

For lines with very large slopes, Brent tends to do a more realistic job of estimating the errors in the fitted parameters. We illustrate with some made-up data, mydata which can be generated by the following Mathematica code:

[Graphics:../Images/index_gr_22.gif]

First we fit to this data using the "standard" technique instead of using Brent minimisation:

 A0 = 0 ± 69000.
A1 = 175000. ± 1400.
Chi Squared = 1.13652 × 10-26 for 8 Degrees of Freedom
(Chi-squared probability: 100.)
[Graphics:../Images/index_gr_24.gif]

Fitting using the default method of Brent minimisation yields:

 A0 = 0 ± 19000.
A1 = 175000. ± 11000.
Chi Squared = 1.96678 × 10-6 for 8 Degrees of Freedom
(Chi-squared probability: 100.)
[Graphics:../Images/index_gr_27.gif]

Compared to Brent's calculation, the non-Brent method seems to have errors that are too small.

The disadvantages of the Brent method are: (1) it is only available for straight-line fits, (2) it is about an order of magnitude slower than the standard method, and (3) it cannot return the full covariance matrix.


PreviousTable of ContentsNext


Authors

This help document is Copyright © 1999 David M. Harrison. The sample screens are Copyright © 1999 Solomon R.C. Douglas and David M. Harrison. This is version 1.1 of the help document, date (m/d/y) 11/25/99.