Weighted Least Squares Fitting For Errors in X and Y

One common problem in scientific experiments is to fit a model to a data set that contains uncertainties. Many commercial packages are available that allow weighted least-squares fitting of experimental data sets.  We have determined that problems existed in several commercial packages that perform weighted least squares fitting; several vendors have changed their analysis programs because of these problems. Details of this can be found in the 2001 AAPT Presentation below.  Unfortunately, there are no commercial packages that allow fitting of data sets that have uncertainties in both the X and Y directions.
 

We have developed the Modelfit package for doing least-squares fitting of data with uncertainties in X and Y.  The computational core of this package has been used for over a decade in our physics course.  The basis is the Levenberg/Marquardt algorithm from Bevington along with an algorithm for iteratively incorporating the uncertainties in X (M. Lybanon, Am. J. Phys, 52, 22-26, 1984).  We have turned this into a DLL subroutine library that can be called from essentially any programming  package (Visual Basic/C++/Fortran, Excel, etc.).

In particular, we have written a macro package for Sigmaplot that allows users to easily fit and plot their data sets. This combines the high-quality plotting ability of Sigmaplot with a computational core that correctly fits data sets with uncertainties in X and Y directions.  With a few minor changes in the Sigmaplot macro files, this can be easily incorporated into the Sigmaplot menu structure.  This Modelfit package is currently being used by a large range of students and has been found to be quite easy for the students to use.


Thomas Huber and Steven Mellema                               
Physics Department                      
Gustavus Adolphus College
St. Peter, MN 56082
March 27, 2002

 
 

Number of Hits Since March 27, 2002